[ckan-dev] Can search function work across all levels - dataset, organisation and group level -

Qifeng.Bai at csiro.au Qifeng.Bai at csiro.au
Mon Jan 19 22:20:18 UTC 2015


Here is a question concerning the search function of the database.  As far as I can ascertain the search function works on identifying key words from the "dataset" level of the database.  Is it possible that the search function can be expanded to consider the "organisation" and "group" levels as well.
Alex gave a solution:
1, change Solr configuration: adding
+<copyField source="organization" dest="text"/>
+<copyField source="groups" dest="text
2, Edit query.py: adding
+        elif ':' not in q:
+            query['q'] = query['q'] + " OR organization:*"+query['q']+"*" + " OR groups:*"+query['q']+"*"

However, I got an error: "org.apache.lucene.queryParser.ParseException: Cannot parse \'test OR organization:*test* OR groups:*test*\': \'*\' or \'?\' not allowed as first character in WildcardQuery"',)

I knew it was caused by Lucene doesn't allow to start WildcardQueries with an asterisk by default, because those are incredibly expensive queries and will be very, very, very slow on large indexes.

Anyone can tell me how to solve this problem?

Cheers










[cid:image001.gif at 01CC55BF.85E7FEB0]

Qifeng Bai
Software Engineer
CSIRO Land and Water
Black Mountain, Canberra

Ph: +61-2-62465704
Web: www.clw.csiro.au



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20150119/ebca81fe/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 2094 bytes
Desc: image001.gif
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20150119/ebca81fe/attachment-0002.gif>


More information about the ckan-dev mailing list