[ckan-dev] Problem searching in organization (unrelated to ckanext-hierarchy) SOLVED
lucia.espona at wsl.ch
lucia.espona at wsl.ch
Wed Aug 17 14:30:35 UTC 2016
Thanks Adrià
The problem came just from Solr config, I realized I need to specify "text" as default field in the query while this should be assumed from the schema.
I just set up a new multicore installation on Solr 5.5.2. I replaced 5.2.1 because of an exception I was getting when indexing through CKAN that seemed to be a bug.
The tag "defaultSearchField" is deprecated in this new version and one should define this in the solrconfig.xml instead:
<requestHandler name="/select" class="solr.SearchHandler">
<!-- default values for query parameters can be specified, these
will be overridden by parameters in the request
-->
<lst name="defaults">
<str name="echoParams">explicit</str>
<int name="rows">10</int>
<str name="df">text</str>
</lst>
It took me a while to realize that because in the Solr UI at the Schema Browser the default field was properly defined as "text", just ignored when querying.
All works fine now :)
Best,
Lucia
_________________________________________________________
Dr. Lucia Espona Pernas
Swiss Federal Institute for Forest, Snow and Landscape Research WSL
Hauptgebäaude Labortrakt (HL C21)
Zürcherstrasse 111
8903 Birmensdorf
Switzerland
+41 44 739 28 71 phone direct
+41 44 739 21 11 reception
www.wsl.ch
-----"ckan-dev" <ckan-dev-bounces at lists.okfn.org> wrote: -----
To: CKAN Development Discussions <ckan-dev at lists.okfn.org>
From: Adrià Mercader
Sent by: "ckan-dev"
Date: 17.08.2016 12:06
Subject: Re: [ckan-dev] Problem searching in organization (unrelated to ckanext-hierarchy)
Hi Lucia,
Don't apologise for writing to the list, that's why it is set up!
You can see the exact queries Solr is receiving by looking at the Solr
logs. These will be in:
* Tomcat: /var/log/tomcat7/catalina.out
*Jetty: /var/log/jetty/2016_08_17.stderrout.log
What you describe sounds bizarre, and it might still be a side-effect
of ckanext-hierarchy
Hope this helps,
Adrià
On 17 August 2016 at 10:41, <lucia.espona at wsl.ch> wrote:
> Dear all,
>
>
> Sorry for writing so much, I am still desperate trying to find out why I
> cannot search for datasets inside the organization read page. If I write
> something in the search box, result is always zero datasets. I removed
> ckanext-hierarchy but it doesn't seem to be causing the issue. Here an
> example:
>
> http://envidat02.wsl.ch:5000/organization/wsl -> 2 Datasets
> http://envidat02.wsl.ch:5000/organization/wsl?q=test&sort=score+desc%2C+metadata_modified+desc
> -> 0 Datasets!!
>
> There are matching datasets (public and active):
>
> http://envidat02.wsl.ch:5000/dataset?q=test&organization=wsl&sort=score+desc%2C+metadata_modified+desc
> -> 2 Datasets
>
> I went on debugging and came to query.py where the query for Solr is created
> and the only difference seems to be the 'q' content:
>
> Empty search text:
>
> 2016-08-17 11:19:53,333 DEBUG [ckan.lib.search.query] Package query:
> {'sort': 'score desc, metadata_modified desc', 'fq': [u' +site_id:"default"
> +state:active'], 'facet.mincount': 1, 'rows': 21, 'facet.field':
> ['organization', 'groups', 'tags', 'res_format', 'license_id'],
> 'facet.limit': '50', 'facet': 'true', 'q': u'
> owner_org:"332fe580-e16f-4e2e-9018-be65e430a3a0"', 'start': 0, 'wt': 'json',
> 'fl': 'id validated_data_dict'}
>
> 2016-08-17 11:19:53,335 DEBUG [ckan.lib.search.query] Package query results
> count: 2
>
> Search text is "test":
>
> 2016-08-17 11:21:09,458 DEBUG [ckan.lib.search.query] Package query:
> {'sort': u'score desc, metadata_modified desc', 'fq': [u' +site_id:"default"
> +state:active'], 'facet.mincount': 1, 'rows': 21, 'facet.field':
> ['organization', 'groups', 'tags', 'res_format', 'license_id'],
> 'facet.limit': '50', 'facet': 'true', 'q': u'test
> owner_org:"332fe580-e16f-4e2e-9018-be65e430a3a0"', 'start': 0, 'wt': 'json',
> 'fl': 'id validated_data_dict'}
>
> 2016-08-17 11:21:09,460 DEBUG [ckan.lib.search.query] Package query results
> count: 0
>
>
> I tried to do (almost) the same query in Solr directly and there is no
> problem:
>
> { "responseHeader":{
> "status":0,
> "QTime":0,
> "params":{
> "q":"test owner_org:\"332fe580-e16f-4e2e-9018-be65e430a3a0\"",
> "df":"text",
> "indent":"true",
> "fl":"id data_dict",
> "rows":"20",
> "wt":"json"}},
> "response":{"numFound":2,"start":0,"docs":[...] ...
>
>
> Is there a way to get the exact URL of the Solr query that CKAN is
> requesting?
> Does anyone have an idea what else can I do to find out the problem?
>
> Many thanks in advance, I have no further ideas how to solve this.
>
> Best,
> Lucia
>
>
>
> _________________________________________________________
> Dr. Lucia Espona Pernas
>
> Swiss Federal Institute for Forest, Snow and Landscape Research WSL
> Hauptgebäaude Labortrakt (HL C21)
> Zürcherstrasse 111
> 8903 Birmensdorf
> Switzerland
>
> +41 44 739 28 71 phone direct
> +41 44 739 21 11 reception
>
> www.wsl.ch
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>
_______________________________________________
ckan-dev mailing list
ckan-dev at lists.okfn.org
https://lists.okfn.org/mailman/listinfo/ckan-dev
Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20160817/fb5ba9a9/attachment-0003.html>
More information about the ckan-dev
mailing list