lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: SpanRegexQuery causes error
Date Thu, 07 Sep 2006 13:20:56 GMT
What's the .toString on the query it parsed to?  Keep in mind that  
"*" isn't the proper regular expression to match everything - it  
would be ".*" or some other pattern.

	Erik


On Sep 7, 2006, at 7:41 AM, Luke Tan wrote:

> Hi,
>
> I am using code in
> http://mail-archives.apache.org/mod_mbox/lucene-java-user/ 
> 200605.mbox/% 
> 3CBED850C725E74F47A0F69CC0EE9AB64D02BA6A9C@CORPUSMX40B.corp.emc.com%3E
>
> for wildcard search in phrase
>
> but it seems that I can only search something like:
>
> "one two three word*"
>
> but not
>
> "one * three word"
>
> It throws error:
>
>
> java.lang.NullPointerException
>    at java.util.Hashtable.get(Hashtable.java:336)
>    at org.apache.lucene.index.MultiReader.norms(MultiReader.java:163)
>    at org.apache.lucene.search.spans.SpanWeight.scorer 
> (SpanWeight.java:70)
>    at org.apache.lucene.search.IndexSearcher.search 
> (IndexSearcher.java:129)
>    at org.apache.lucene.search.IndexSearcher.search 
> (IndexSearcher.java:110)
>    at org.apache.lucene.search.Hits.getMoreDocs(Hits.java:65)
>    at org.apache.lucene.search.Hits.<init>(Hits.java:52)
>    at org.apache.lucene.search.Searcher.search(Searcher.java:53)
>
> The query text is analyzed using this:
>
>        if (!StringUtils.isEmpty(queryText)) {
>            if (queryText.indexOf("*") == 0 || queryText.indexOf 
> ("?") == 0)
> return null;
>
>            if (queryText.indexOf(' ') != -1) {
>                SpanRegexQuery srq = new SpanRegexQuery(new Term(field,
> queryText));
>                SpanFirstQuery sfq = new SpanFirstQuery(srq, 1);
>                return sfq;
>            }
>        }
> Query getFieldQuery(String field, String queryText) throws  
> ParseException
>
> Thanks
> Luke
> inside


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message