Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing field on reindexing data with solr 5 and sunspot 2.2.0 #749

Open
pamio opened this issue Jan 3, 2016 · 1 comment
Open

Missing field on reindexing data with solr 5 and sunspot 2.2.0 #749

pamio opened this issue Jan 3, 2016 · 1 comment

Comments

@pamio
Copy link

pamio commented Jan 3, 2016

Hi,
I'm upgrading to solr 5 and seems like sunspot does support solr 5 with reference to this #658

Which does work of course, I can reindex my data and see the same on solr admin.However, I'm running through some issues.

I have a solr 4 in the production which is working great but I want to upgrade to solr 5 so it doesn't become a legacy.

While I can get grouping working flawlessly in solr 4, I'm having a hard time to get it working with solr 5. I matched the query on solr admins both on 4 and 5, they are the same but the result is not.

Here is what I'm doing:

The query on my local which is running solr 5 is
http://localhost:8983/solr/development/select?q=*%3A*&fq=city_ids_im%3A(1+OR+2+OR+3+OR+4+OR+5)+AND+kinds_im%3A(2+OR+9)+AND+live_b%3Atrue+AND+medium_i%3A(1)+AND+zone_id_i%3A(9)++AND+(medium_i%3A(0+OR+3)+OR+_query_%3A%22%7B!geofilt%7D%22)+&sort=kind_i+asc%2C+importance_i+desc&start=0&rows=10&fl=distance%3Ageodist()+AND+doc_id%3Aid&wt=ruby&indent=true&facet=true&facet.query=f.category_str_s.facet.mincount%3D1%26f.zone_str_s.facet.mincount%3D1%26f.medium_i.facet.mincount%3D1&facet.field=category_str_s%2C+zone_str_s%2C+medium_i&spatial=true&pt=12.910223199999999%2C77.59227489999999&sfield=location_ll&d=10000&group=true&group.field=promotion_id_str_s

and the corresponding result is

{ 'responseHeader'=>{ 'status'=>0, 'QTime'=>2}, 'grouped'=>{ 'promotion_id_str_s'=>{ 'matches'=>13, 'groups'=>[{ 'groupValue'=>nil, 'doclist'=>{'numFound'=>13,'start'=>0,'docs'=>[ { 'distance'=>1749.7472143461096, 'doc_id'=>'Offering 35894'}] }}]}}, 'facet_counts'=>{ 'facet_queries'=>{ 'f.category_str_s.facet.mincount=1&f.zone_str_s.facet.mincount=1&f.medium_i.facet.mincount=1'=>0}, 'facet_fields'=>{ 'category_str_s, zone_str_s, medium_i'=>[]}, 'facet_dates'=>{}, 'facet_ranges'=>{}, 'facet_intervals'=>{}, 'facet_heatmaps'=>{}}}

see the key groupValue which is nil.

The same query when run against a solr 4 I get the correct result.

{ 'responseHeader'=>{ 'status'=>0, 'QTime'=>1, 'params'=>{ 'facet'=>'true', 'd'=>'10000', 'sort'=>'kind_i asc, importance_i desc', 'spatial'=>'true', 'indent'=>'true', 'sfield'=>'location_ll', 'wt'=>'ruby', 'rows'=>'10', 'fl'=>'distance:geodist() AND doc_id:id', 'facet.query'=>'f.category_str_s.facet.mincount=1&f.zone_str_s.facet.mincount=1&f.medium_i.facet.mincount=1', 'start'=>'0', 'q'=>'*:*', 'pt'=>'12.910223199999999,77.59227489999999', 'group.field'=>'promotion_id_str_s', 'facet.field'=>'category_str_s, zone_str_s, medium_i', 'group'=>'true', 'fq'=>'city_ids_im:(1 OR 2 OR 3 OR 4 OR 5) AND kinds_im:(2 OR 9) AND live_b:true AND medium_i:(1) AND zone_id_i:(9) AND (medium_i:(0 OR 3) OR _query_:"{!geofilt}") '}}, 'grouped'=>{ 'promotion_id_str_s'=>{ 'matches'=>21, 'groups'=>[{ 'groupValue'=>'12823', 'doclist'=>{'numFound'=>1,'start'=>0,'docs'=>[ { 'distance'=>8663.289747853021, 'doc_id'=>'Offering 38631'}] }}, ........... // Commented }}]}}, 'facet_counts'=>{ 'facet_queries'=>{ 'f.category_str_s.facet.mincount=1&f.zone_str_s.facet.mincount=1&f.medium_i.facet.mincount=1'=>0}, 'facet_fields'=>{ 'category_str_s, zone_str_s, medium_i'=>[]}, 'facet_dates'=>{}, 'facet_ranges'=>{}}}

But When I try using sunspot_solr and reindex the data I get the correct result. But then I dont intend to use that for production.
Here is query fired from Rails

SOLR Request (23.4ms) [ path=select parameters={fq: ["type:Offering", "((city_ids_im:(1 OR 2 OR 3 OR 4 OR 5) AND kinds_im:(2 OR 9) AND start_i:{* TO 1451820268} AND stop_i:{1451820268 TO *} AND live_b:true AND medium_i:(1) AND zone_id_i:(9)) AND (medium_i:(0 OR 3) OR _query_:"{!geofilt}"))"], start: 0, rows: 10, group: "true", group.ngroups: "true", group.field: ["promotion_id_str_s"], facet: "true", f.category_str_s.facet.mincount: 1, facet.field: ["category_str_s", "zone_str_s", "medium_i"], f.zone_str_s.facet.mincount: 1, f.medium_i.facet.mincount: 1, sort: "kind_i asc, coupons_i desc", sfield: "location_ll", pt: "12.910223199999999,77.59227489999999", d: "10000", fl: "distance:geodist() AND doc_id:id", q: "*:*"} ]

Which works on sunspot_solr and a standalone solr4 but not on standalone solr 5

Questions:

  1. Can I run solr 5 with rails 3.2.13 ? If yes, which sunspot gem supports it ? I tried using sunspot 2.2.0 but failed.
  2. Am I missing something on this for which grouping is not working ?

Note:
Further investigation on this reveals that some fields are missing in the schema. I opened the solr admin schema-browser for solr 5 and solr 4 and found that there are few fields missing all of which are string fields. The field promotion_id_str_s exists in solr 4 but not in solr5.

What am I missing here ? I installed the latest gem and copied its config file to solr5 and then ran reindex but no luck.

Best,
Pramod Solanky

@pamio pamio changed the title Grouping in solr 5 doesn't work ? Missing field on reindexing data Jan 4, 2016
@pamio pamio changed the title Missing field on reindexing data Missing field on reindexing data with solr 5 and sunspot 2.2.0 Jan 4, 2016
@pamio
Copy link
Author

pamio commented Dec 2, 2016

Anyone ? Can someone help ? I found that all the boolean and string fields are getting indexed and I verified by checking solr web schema browser but none of the string and text fields were indexed. Any thoughts ? solrconfig.xml and schema.xml were downloaded from solrconfig and schema respectively.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant