0
votes

Current Features:

  • Autocomplete using solr terms component, parameter terms.prefix.
  • bounding box for geo location searches.

Things Tried:

  • I have tried to combine both queries into one. However I never get the results to filter by geo location. Rather I get everything from the terms.prefix search.
  • I have also tried using dismax, edismax + bbox geo location search. I know that dismax wouldn't work because it doesn't have a prefix parameter.
  • I looked day and night on Google try to figure this out.
  • I would hate to stem on my field name "names", so that every letter gets considered a keyword.

Any help is really appreciated.

1

1 Answers

3
votes

Unfortunately you cannot do this in the termscomponent as it simply does not support filtering based on other fields than the one that you are issuing the terms component on.

The simplest solution to the problem is to use the standard requesthandler (ie <requestHandler name="standard" class="solr.SearchHandler>) with your bounding box filter:

fq={!bbox}&sfield=store&pt=45.15,-93.85&d=5

and a facet on the field that you want to list terms for (assuming your field name is 'names'):

facet=true&facet.field=names&f.names.facet.prefix=$yourprefix$

you will end up with a query like:

/select?q=*:*&fq={!bbox}&sfield=store&pt=45.15,-93.85&d=5&facet=true&facet.field=names&f.names.facet.prefix=$yourprefix$

giving a result like:

<lst name="facet_counts">
  <lst name="facet_queries"/>
    <lst name="facet_fields">
      <lst name="name">
        <int name="maxtor">1</int>
        <int name="memory">1</int>
        <int name="mobile">1</int>
        <int name="mp500">1</int>
        <int name="mb">0</int>
        <int name="mini">0</int>
      </lst>
   </lst>
</lst>

(in the facet section)