lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "" <>
Subject Re: Search for numbers
Date Fri, 22 May 2015 04:12:57 GMT
Hi Holger,

It’s not apparent to me why you are using the spatial field to index a
number.  Why not simply a “tfloat” or whatever numeric field?  Then you
could use {!frange} with a function to get the difference and filter it to
be in the range you want.

RE query parsing (problem #1): you should write a custom query parser…
perhaps by forking ExtendedDisMaxQParser to meet your needs.  But I think
you’ll have something cleaner / more maintainable if you write one from
scratch while looking at that QParser for tips/inspiration; not porting the
features you don’t want.

RE problem #2: I’m a little unclear on what you want to do, but it’s likely
you can express it with {!frange} on a number field (not spatial) with the
right functions.  If you can’t), you could write either a custom function
(AKA ValueSource) or if needed a frange like thing for your custom needs.

~ David

On Thu, May 21, 2015 at 3:22 AM Holger Rieß <>

> Hi,
> I try to search numbers with a certain deviation. My parser is
> ExtendedDisMax.
> A possible search expression could be 'twist drill 1.23 mm'. It will not
> match any documents, because the document contains the keywords 'twist
> drill', '1.2' and 'mm'.
> In order to reach my goal, I've indexed all numbers as points with the
> solr.SpatialRecursivePrefixTreeFieldType.
> For example '1.2' as <field name="feature_nr">1.2 0.0</field>.
> A search with 'drill mm' and a filter query 'fq={!geofilt pt=0,1.23
> sfield=feature_nr d=5}' delivers the expected results.
> Now I have two problems:
> 1. How can I get ExtendedDisMax, to 'replace' the value 1.2 with the
> '{!geofilt}' function?
>   My first attemts were
> - Build a field type in schema.xml and replace the field content with a
> regular expression
> '... replacement="_query_:&quot;{!geofilt pt=0,$1 sfield=feature_nr
> d=5}&quot;"'.
> The idea was to use a nested query. But edismax searches
> 'feature_nr:_query_:"{!geofilt pt=0,$1 sfield=feature_nr d=5}"'.
> No documents are found.
> - Program a new parser that analyzes the query terms, finds all numbers
> and does the geospatial stuff. Added this parser in the 'appends' section
> of the 'requestHandler' definition. But I can get this parser only to
> filter my results, not to extend them.
> 2. I want to calculate the distance (d) of the '{!geofilt}' function
> relative to the value, for example 1%.
> Could there be a simple solution?
> Thank you in advance.
> Holger

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message