i saw synonym Filter but it is not sufficient for me.as i saw this, i must
build synonym filter map . that this is built like a map i mean i must put
exactly in synonym map for example "home" is synonym of "house" (for
example).
so in query when user insert home it filter add house to it and expand this.
but i don't want this. i have a algorithm that get n words and according to
it and use of wordnet ,it make a decision that what word must be add to
expand this query. it depends on all words exist on query.
so i can not tokenize my query word by word.
because of if i tokenize query word by word .then in synonym filter factory
i have just one token and i can not make a decision what word must be added
to query. i need to have all word together.
and also i can not tokenize my query with "." for example because i wanna
to tokenize my query word by word to normalize every word. so i can not
change tokenize format.
and i can not use synonymfilterfactory.
how i can do this?i got all query words and expand this with my algorithm
based on using wordnet?

On Mon, Jul 25, 2016 at 5:32 AM, Erik Hatcher <erik.hatc...@gmail.com>
wrote:

> You’re going to need to tokenize to look up words, so a TokenFilter is a
> better place to put this sort of thing, I think.
>
> Build off of Lucene’s SynonymFilter (and corresponding
> SynonymFilterFactory)
> https://github.com/apache/lucene-solr/blob/5e5fd662575105de88d8514b426bccdcb4c76948/lucene/analysis/common/src/java/org/apache/lucene/analysis/synonym/SynonymFilter.java
> <
> https://github.com/apache/lucene-solr/blob/5e5fd662575105de88d8514b426bccdcb4c76948/lucene/analysis/common/src/java/org/apache/lucene/analysis/synonym/SynonymFilter.java
> >
>
> I’m not sure exactly what your code is trying to do (please share that as
> well, for best assistance), but I do not recommend putting custom code into
> Solr’s package namespaces (and obviously that has issues here, because of
> the separate JAR and visibility/access).
>
>         Erik
>
>
> > On Jul 25, 2016, at 2:25 AM, sara hajili <hajili.s...@gmail.com> wrote:
> >
> > i use solr 6-1-0.
> > and i write my own search Handler .i got this error:
> >
> > java.lang.IllegalAccessError: tried to access field
> > org.apache.solr.handler.component.ResponseBuilder.requestInfo from
> > class org.apache.solr.handler.component.MyResponseBuilder
> >       at
> org.apache.solr.handler.component.MyResponseBuilder.getRequestInfo(MyResponseBuilder.java:19)
> >       at
> org.apache.solr.handler.component.MySearchHandler.handleRequestBody(MySearchHandler.java:94)
> >       at
> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:156)
> >       at org.apache.solr.core.SolrCore.execute(SolrCore.java:2036)
> >       at
> org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:657)
> >       at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:464)
> >       at
> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:257)
> >       at
> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:208)
> >       at
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1668)
> >       at
> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:581)
> >       at
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
> >       at
> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
> >       at
> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
> >       at
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1160)
> >       at
> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)
> >       at
> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
> >       at
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1092)
> >       at
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
> >       at
> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)
> >       at
> org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:119)
> >       at
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
> >       at org.eclipse.jetty.server.Server.handle(Server.java:518)
> >       at
> org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:308)
> >       at
> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:244)
> >       at
> org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
> >       at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
> >       at
> org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
> >       at
> org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:246)
> >       at
> org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:156)
> >       at
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)
> >       at
> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)
> >       at java.lang.Thread.run(Thread.java:745)
> >
> >
> > because of in solr6-1-0 searchHandler 2 fields in responseBuilder
> > declare as a package access type(isDistrib and requestInfo).and in
> > this class does not exist any getter to this fields.
> >
> > so when i implement MySearchHandler and create new class
> > "MySearchHandler" in new java project and put in package
> > "org.apache.solr.handler"
> >
> > and extends mySearchHandler form searchHandler.
> >
> > so in compile time it is not issue that we use field with package
> > access("idea in compile time assume that they are in same package")
> >
> > but when i create a jar file and put in solr .and in solr-config file
> > i put my handler "MySearchHandler" as /mySearchhandler i got above
> > error.
> >
> > so it shows that in runtime solr find 2 jar file with same package
> > name.but could not recognize that they are in same package and let
> > mysearchHandler to use filed of "isDistrib and requestInfo (with
> > package declare)"
> >
> > so i see that searchhandler is in solr-core jar file,.so i puth this
> > jarfile to my searchhandler jar file,and delete solr-core jar file
> > from lib of solr web-app and then restart solr."i do this because i
> > don't have a 2 jar file with same packae name ,and in run time solr
> > fo=ind out them in same package and let me to uyse 2 fileds"
> >
> > but after do that i try to start solr .but now solr did n't start and
> > i got this in command line:
> >
> > "solr could n't start after 30 second." // some thing like a timeout
> exception
> >
> >
> > so now i think  maybe i select a wrong approach to expand my queries
> > and add wordnet to solr.
> >
> > and please describe how i can use synonym filter factory or tokenizar
> > that u said i can use them to expand query.
> >
> > tnx
> >
> >
> > On Sun, Jul 24, 2016 at 12:09 PM, Erik Hatcher <erik.hatc...@gmail.com>
> > wrote:
> >
> >> Have a look at Solr's source code and you will see many TokenFilter
> >> implementations.  The synonym token filter is the closest to what you
> want.
> >>
> >> But maybe first - please detail (copy/paste) the exact error you were
> >> getting in your handler.  It's still not my recommended approach but it
> >> sounds like you're new to Solr development and need to iron out some
> issues
> >> first.
> >>
> >>   Erik
> >>
> >>> On Jul 24, 2016, at 13:20, sara hajili <hajili.s...@gmail.com> wrote:
> >>>
> >>> How i can implement this as q token filter.?
> >>> I wanna to expand query with wordnet.
> >>> So i try to implement my search handler. In this way i got solrparam. Q
> >>> And send it to wordnet and expand this.
> >>> I write this to mysearch handler. So when user insert a query like
> q=tree
> >>> and apple.
> >>> I expand this query with orange.
> >>>> On Jul 24, 2016 8:37 PM, "Erik Hatcher" <erik.hatc...@gmail.com>
> wrote:
> >>>>
> >>>> My first inclination would be to implement this as a TokenFilter
> >> instead.
> >>>> Can you provide some examples of what you want?
> >>>>
> >>>>> On Jul 24, 2016, at 08:22, sara hajili <hajili.s...@gmail.com>
> wrote:
> >>>>>
> >>>>> hi all.
> >>>>> i wanna to expand my queries with wordnet ...
> >>>>> so i try to write my own SearchHandler class."/mysearchHandler"
> >>>>> so i add new requestHandler in solr-config  /mySearchHandler
> >>>>> but i faced with problem. i found some field that they were package
> >>>> access .
> >>>>> so i get access error in run query.(this field does n't have any
> getter
> >>>> to
> >>>>> use them)
> >>>>> and now my question is what is best approach to expand my queris with
> >>>>> wordnet?
> >>>>> is good to write my own searchHandler?and overwrite it to get my
> >> result?
> >>>>> tnx
> >>>>
> >>
>
>

Reply via email to