lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan McKinley <ryan...@gmail.com>
Subject edismax with windows path input?
Date Thu, 10 Feb 2011 19:36:05 GMT
I am using the edismax query parser -- its awesome!  works well for
standard dismax type queries, and allows explicit fields when
necessary.

I have hit a snag when people enter something that looks like a windows path:
<lst name="params">
 <str name="q">F:\path\to\a\file</str>
</lst>
this gets parsed as:
<str name="rawquerystring">F:\path\to\a\file</str>
<str name="querystring">F:\path\to\a\file</str>
<str name="parsedquery">+()</str>

Putting it in quotes makes the not-quite right query:
<str name="rawquerystring">"F:\path\to\a\file"</str>
<str name="querystring">"F:\path\to\a\file"</str>
<str name="parsedquery">
+DisjunctionMaxQuery((path:f:pathtoafile^4.0 | name:"f (pathtoafile
fpathtoafile)"^7.0)~0.01)
</str>
<str name="parsedquery_toString">
+(path_path:f:pathtoafile^4.0 | name:"f (pathtoafile fpathtoafile)"^7.0)~0.01
</str>

Telling people to escape the query:
q=F\:\\path\\to\\a\\file
is unrealistic, but gives the proper parsed query:

+DisjunctionMaxQuery((path_path:f:/path/to/a/file^4.0 | name:"f path
to a (file fpathtoafile)"^7.0)~0.01)

Any ideas on how to support this?  I could try looking for things like
paths in the app, and then modify the query, or maybe look at
extending edismax.  Perhaps when F: does not match a given field, it
could auto escape the rest of the word?

thanks
ryan

Mime
View raw message