lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jagdish Vasani IN" <jvas...@in.Capitallegals.com>
Subject RE: How to eliminate stop words from Surround query ?
Date Fri, 27 Aug 2010 14:57:23 GMT
Hi,

I get it working..here is logic that need to implement...

In function getTermQuery check term is stop word or not if it is stop
word then return null.
Otherwise return SrndTermQuery object..

Code ...

protected SrndQuery getTermQuery(
        String term, boolean quoted) {
       if(stopwordList != null && stopwordList.contains(term))
            return null;
    return new SrndTermQuery(term, quoted);
}

Here stopwordList is static collection..


Next in each Query function (NQuery, NotQuery, AndQuery, WQuery) add
code as per following OrQuery 


SrndQuery OrQuery() : {
  SrndQuery q;
  SrndQuery prevq = null;
  ArrayList queries = null;
  Token oprt = null;
}{
  q = AndQuery()
  ( oprt = <OR> { /* keep only last used operator */
      if (queries == null) {
        queries = new ArrayList();
      }
      if(q != null)
        queries.add(q);
      prevq = q;
      if(queries.size() >= 2){
         q = getOrQuery(queries, true /* infix */, oprt);
         return q;
      }


    }    
    q = AndQuery() {
      if(q != null)
        queries.add(q);
      else
        q = prevq;
        
      if(queries.size() >= 2){
            q = getOrQuery(queries, true /* infix */, oprt);
      }

    }
  )*
  {return q;}
}

Now generate QueryParser.java file using javaCC then do search..

Thanks,
Jagdish.


-----Original Message-----
From: Jagdish Vasani IN [mailto:jvasani@in.Capitallegals.com] 
Sent: Monday, August 23, 2010 7:33 PM
To: java-user@lucene.apache.org
Subject: How to eliminate stop words from Surround query ?

Hi,

 

All , I want to eliminate stop words from surround  query how I can do
that ...as I am new to QueryParser languages(JavaCC) ..

Any Ideas or suggestions ?

 

Thanks,

Jagdish


---------------------------------------------------------------------
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