xml - Solr with normalized document structure -
i have solr document this, fields mapped single document.
<doc> <int name="id">7</int> <str name="name">personname</str> <str name="address">address line 1, address line 2, city</str> <str name="country">india</str> <str name="imageurl">0000028415.jpeg</str> <arr name="category"> <str>student</str> <str>group a</str> </arr> </doc>
we normalize , have separate doc type person, country , category.
<doc> <int name="pid">7</int> <str name="name">personname</str> <str name="address">address line 1, address line 2, city</str> <str name="countryid">91</str> <str name="imageurl">0000028415.jpeg</str> <arr name="categoryid"> <str>2</str> <str>5</str> </arr> </doc> <doc> <int name="cid">91</int> <str name="countryname">india</str> </doc> <doc> <int name="catid">2</int> <str name="categoryname">student</str> </doc>
note simplifying example, actual document work complex this, , have millions of documents in index.
i understand, how join , filter query kind of document structure. , how impact performance compared previous case, details stored in single doc structure.
update
sample query current structure, hope helps idea on how done currently:
here sample query search facets applied -
/select?indent=on&wt=json&facet.field={!ex%3dcategory}category&facet.field=manufacturer&facet.field=vendor&facet.field=f_hardrive&facet.field=f_operating%2bsystem&facet.field=f_memory&facet.field=f_cpu%2btype&facet.field=f_screensize&facet.field=pa_os&bf=&start=0&fq={!tag%3dcategory}category:notebooks&fq=price:[0+to+9999999999999]&rows=6&version=2.2&bq=&facet.query=averagerating:[4+to+5]&facet.query=averagerating:[3+to+5]&facet.query=averagerating:[2+to+5]&facet.query=averagerating:[1+to+5]&q=(laptop)&deftype=edismax&spellcheck.q=(laptop)&qf=name^7++shortdescription^6++fulldescription^4+categorycopy^2+manufacturercopy^2+sku^3+childsku^3+ngramcontent+attributes+productattributes+tag+manufacturerpartnumber+customproperties&spellcheck=true&stats=true&facet.mincount=1&facet=true&spellcheck.collate=true&stats.field=price
this filter query facets:
select?indent=on&wt=json&facet.field=f_hardrive&facet.field=f_operating%2bsystem&facet.field=f_memory&facet.field=f_cpu%2btype&facet.field={!ex%3df_screensize}f_screensize&facet.field=pa_hdd&facet.field=pa_os&facet.field={!ex%3dpa_os}pa_os&facet.field=pa_os&facet.field=pa_processor&facet.field=pa_ram&facet.field=pa_software&facet.field=vendor&facet.field={!ex%3dmanufacturer}manufacturer&facet.field=category&start=0&fq=stockavailability:(true)&fq={!tag%3df_screensize}f_screensize:15.0%2527%2527\!!4!!&fq={!tag%3dpa_os}pa_os:apple\!!0!!&fq={!tag%3dprice}price:[594+to+1800]&sort=cdo_1+asc&rows=6&version=2.2&facet.query=averagerating:[4+to+5]&facet.query=averagerating:[3+to+5]&facet.query=averagerating:[2+to+5]&facet.query=averagerating:[1+to+5]&q=categoryid:(1+or+2+or+3+or+4)&deftype=edismax&spellcheck=true&stats=true&facet.mincount=1&facet=true&spellcheck.collate=true&stats.field=price
the thing comes mind using xsltresponsewriter modify query response xslt file transforms response in more adequate one.
- check: https://wiki.apache.org/solr/xsltresponsewriter
- check: https://lucene.apache.org/solr/guide/6_6/response-writers.html
don't know if thats wanted.
Comments
Post a Comment