*The real problem I'm trying to solve*: I want to be able to do range
queries against an analyzed field after somehow applying that analysis to
the user input, 'cause range queries ignore analyzers.

*The data*
...is library call numbers. I need to do some pretty nasty transformations
on them to make them searchable/sortable. One of the requirements is to be
able to filter on "all the callnumbers that sort after your search text."

*What I've got:*

   - Java code that does the transformation
   - A working  custom analyzer (Filter/FilterFactory classes) that use
   that transformation code
   - A working custom function (ValueSource/ValueSourceParser classes) that
   uses that same code to apply the transformation

*What I (think I) need*
A way to do an open-ended range query that compares a transformed version
of the user's input with the value actually indexed in the fields of the
records.

*What's stopping me*
Range queries don't use the analysis chain, so I've got raw user query
terms being compared to analyzed indexed terms.

*What I'd like to avoid*
...is having to re-create the transformation code for every client and run
it before sending the user term to solr. 'Cause we all know those
supposedly-parallel code bases in multiple languages are going to get out
of sync by tomorrow afternoon, making doing everything in the solr process
so very, very appealing.

*What I'd hoped to somehow do:*

I had this idea that maybe I could somehow do an {!frange} call where the
lower/upper limits are set using the function call. If the user entered
"QA11" I'd do something like

{!frange l=callnumberFunc("QA11")}callnumber_sortable

...but that doesn't work -- it's just escaping the double-quotes and
assuming my lower bound is the whole string 'callnumberFunc("QA11")'.

Then I thought maybe I could abuse the other end of the frange:

{!frange l=0}if ( gt(callnumber_sortable, callnumberFunc("QA11")), 1, -1)

But it bails with an UnsupportedOperationException, and how and what to
override and implement all the right things to make that work is
non-obvious to me.

I'm a ruby programmer who's gotten as far as I have on hubris and
cut-and-paste, but I'm to the point where I'm hoping someone can either
help out, or definitively say, "Yeah, that ain't gonna happen."
-- 
Bill Dueber
Library Systems Programmer
University of Michigan Library

Reply via email to