Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
complex query parser
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  17 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
balazs  
View profile  
 More options May 24 2012, 10:31 am
From: balazs <bal...@czifra.net>
Date: Thu, 24 May 2012 07:31:23 -0700 (PDT)
Local: Thurs, May 24 2012 10:31 am
Subject: complex query parser

I'm still rather new to Lucene and Raven and trying to determine whether
it's query capabilities will support our needs. We have a number of
concerns regarding more complex queries such as proximity searches
involving wildcards.  I am seeing frequent mention of the
ComplexPhraseQueryParser being able to handle these sorts of things in
Lucene (
http://lucene.apache.org/core/old_versioned_docs/versions/3_0_2/api/c...)
but it doesn't seem that I can do them with Raven and may have to elect
another alternative such as SOLR.  I'd appreciate any suggestions or
comments from the community.  An example complex query (from the Lucene
site) that matches some of our needs is something like: "(john jon
jonathan~) peters*"


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Itamar Syn-Hershko  
View profile  
 More options May 24 2012, 11:40 am
From: Itamar Syn-Hershko <ita...@hibernatingrhinos.com>
Date: Thu, 24 May 2012 18:40:13 +0300
Local: Thurs, May 24 2012 11:40 am
Subject: Re: [RavenDB] complex query parser

Currently Raven doesn't use this QP, but it's really a no-brainer to do
that. You can even do that yourself through a bundle.

Here's all the source code you'll have to port:
https://github.com/apache/lucene-solr/blob/lucene_solr_3_1/lucene/con...


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
balazs  
View profile  
 More options May 24 2012, 11:51 am
From: balazs <bal...@czifra.net>
Date: Thu, 24 May 2012 08:51:36 -0700 (PDT)
Local: Thurs, May 24 2012 11:51 am
Subject: Re: [RavenDB] complex query parser

Does Raven currently have any mechanism for me to indicate which
queryparser to use for any given query I'm making?  I don't see anything
like that in the source and can probably implement that fairly easily, but
I don't want to reinvent the wheel if there is anything already there.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Itamar Syn-Hershko  
View profile  
 More options May 24 2012, 11:55 am
From: Itamar Syn-Hershko <ita...@hibernatingrhinos.com>
Date: Thu, 24 May 2012 18:55:45 +0300
Local: Thurs, May 24 2012 11:55 am
Subject: Re: [RavenDB] complex query parser

No, because there are no other queryparsers handy there

Take a look at the sources of the MoreLikeThis bundle, we do pretty much
the same thing there. You will need to create a responder, run that QP on
the query string and pass the Query object you get to the searcher, which
is available to you as well.

We might incorporate this ourselves to the core product, just need to make
sure the API keeps simple and all outcomes are considered


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Itamar Syn-Hershko  
View profile  
 More options May 24 2012, 11:57 am
From: Itamar Syn-Hershko <ita...@hibernatingrhinos.com>
Date: Thu, 24 May 2012 18:57:02 +0300
Local: Thurs, May 24 2012 11:57 am
Subject: Re: [RavenDB] complex query parser

It is actually going to be much easier to do this
through AbstractIndexQueryTrigger , that way you won't have to handle
paging etc

On Thu, May 24, 2012 at 6:55 PM, Itamar Syn-Hershko <


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
balazs  
View profile  
 More options May 24 2012, 1:29 pm
From: balazs <bal...@czifra.net>
Date: Thu, 24 May 2012 10:29:52 -0700 (PDT)
Local: Thurs, May 24 2012 1:29 pm
Subject: Re: [RavenDB] complex query parser

Not sure I quite follow you on that.  Beyond just implementing/porting the
parser what else do I need to do?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matt Warren  
View profile  
 More options May 24 2012, 5:15 pm
From: Matt Warren <mattd...@gmail.com>
Date: Thu, 24 May 2012 14:15:47 -0700 (PDT)
Local: Thurs, May 24 2012 5:15 pm
Subject: Re: [RavenDB] complex query parser

@balzas what he means is that you can implement a bundle that will be
called as part of every query. In that bundle you can re-write the query to
make it do whatever you want.

See the code
https://github.com/ravendb/ravendb/blob/master/Raven.Database/Indexin...,
this allows any class that inherits AbstractIndexQueryTrigger to
control/modify all queries.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matt Warren  
View profile  
 More options May 24 2012, 5:30 pm
From: Matt Warren <mattd...@gmail.com>
Date: Thu, 24 May 2012 14:30:02 -0700 (PDT)
Local: Thurs, May 24 2012 5:30 pm
Subject: Re: [RavenDB] complex query parser

See here http://ravendb.net/docs/server/bundles for more info on how
RavenDB bundles work. They don't mention this specific one
(AbstractIndexQueryTrigger) but all triggers work in the same way.

Just create a class that inherits from AbstractIndexQueryTrigger and put it
in the "\Plugins" directory and the server will pick it up and call it
every time a query is performed.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
balazs  
View profile  
 More options May 25 2012, 12:22 am
From: balazs <bal...@czifra.net>
Date: Thu, 24 May 2012 21:22:05 -0700 (PDT)
Local: Fri, May 25 2012 12:22 am
Subject: Re: [RavenDB] complex query parser

This inheriting class only needs to override ProcessQuery(...), right?  I'm
not sure what exactly the "query" and "originalQuery" parameters to that
method are.  Another problem is that once I manager to override this method
correctly, I'm not sure how to debug this "bundle" while running RavenDB
embedded.  I tried to add a Plugins folder to /bin/debug and add an
existing bundle to it, but Raven seems to have completely ignored it.  So,
say I've got the bundle in one project, my unit tests in another project,
all in one solution.  How do I "deploy" the bundle while running RavenDB
embedded, then run a test with a breakpoint somewhere in the
ProcessQuery(...) method.  My apologies if this is naive- I've only been at
Raven a few days and the document on bundles and the like seems pretty
sparse.  


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Itamar Syn-Hershko  
View profile  
 More options May 25 2012, 4:15 am
From: Itamar Syn-Hershko <ita...@hibernatingrhinos.com>
Date: Fri, 25 May 2012 11:15:00 +0300
Subject: Re: [RavenDB] complex query parser

inline

On Fri, May 25, 2012 at 7:22 AM, balazs <bal...@czifra.net> wrote:
> This inheriting class only needs to override ProcessQuery(...), right?
>  I'm not sure what exactly the "query" and "originalQuery" parameters to
> that method are.

Yes

Take the string indexQuery.Query and pass it to the ComplexQP, it will
return a Lucene Query object, and return that

> Another problem is that once I manager to override this method correctly,
> I'm not sure how to debug this "bundle" while running RavenDB embedded.  I
> tried to add a Plugins folder to /bin/debug and add an existing bundle to
> it, but Raven seems to have completely ignored it.  So, say I've got the
> bundle in one project, my unit tests in another project, all in one
> solution.  How do I "deploy" the bundle while running RavenDB embedded,
> then run a test with a breakpoint somewhere in the ProcessQuery(...)
> method.  My apologies if this is naive- I've only been at Raven a few days
> and the document on bundles and the like seems pretty sparse.

Take a look at the Raven.Bundles solution, there is a test suit for server
side bundles there

Basically, in your tests you run an EmbeddedDocumentStore and add the
bundle assembly to the MEF catalog via the doc store configurations


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matt Warren  
View profile  
 More options May 25 2012, 4:39 am
From: Matt Warren <mattd...@gmail.com>
Date: Fri, 25 May 2012 01:39:39 -0700 (PDT)
Local: Fri, May 25 2012 4:39 am
Subject: Re: [RavenDB] complex query parser

Take a look at the bundle I just wrote, this line is where the plugin is
wired up in the test,  
https://github.com/ayende/ravendb/blob/master/Bundles/Raven.Bundles.T...


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
balazs  
View profile   Translate to Translated (View Original)
 More options Jun 26 2012, 3:50 pm
From: balazs <bal...@czifra.net>
Date: Tue, 26 Jun 2012 12:50:29 -0700 (PDT)
Local: Tues, Jun 26 2012 3:50 pm
Subject: Re: [RavenDB] complex query parser

I've implemented the following, relying on the suggestions in this thread:

public class ComplexPhraseIndexUpdateTrigger : AbstractIndexQueryTrigger
{
        public override Lucene.Net.Search.Query ProcessQuery(string
indexName, Lucene.Net.Search.Query query,
Raven.Abstractions.Data.IndexQuery originalQuery)
        {
            var cpqp = new
ComplexPhraseQueryParser(Lucene.Net.Util.Version.LUCENE_29, "Description",
new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29));
            var q = cpqp.Parse(originalQuery.Query);
            return q;
        }

}

Unfortunately wildcard phrase queries aren't processed correctly.  What
seems to happen is that in Lucene.Net.Index.DirectoryReader.MultiTermEnum
the IndexReader[] array passed to the constructor is empty.  I think this
is the method where the wildcard term prefix is supposed to get queried
against the index to identify matching expansions of the term.  However,
because readers.Length == 0 the code that does so never gets run.  As a
result, a query for "labrador ret*" ends up coming back as a boolean query
for "labrador" and "Dummy clause because no terms found - must match
nothing" (ComplexPhraseQueryParser, ~ line 267).  Does anyone have any
ideas why this might be happening?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
balazs  
View profile  
 More options Jun 26 2012, 4:03 pm
From: balazs <bal...@czifra.net>
Date: Tue, 26 Jun 2012 13:03:26 -0700 (PDT)
Local: Tues, Jun 26 2012 4:03 pm
Subject: Re: [RavenDB] complex query parser

I've attached the ComplexPhraseQueryParser for reference.

  ComplexPhraseQueryParser.cs
15K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Oren Eini (Ayende Rahien)  
View profile   Translate to Translated (View Original)
 More options Jun 27 2012, 3:52 am
From: "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
Date: Wed, 27 Jun 2012 10:52:39 +0300
Local: Wed, Jun 27 2012 3:52 am
Subject: Re: [RavenDB] complex query parser

A few things, first, you need to dispose of  StandardAnalyzer , otherwise
you have a memory leak.
And I am not sure about the actual problem. Can you provide a failing test?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
balazs  
View profile   Translate to Translated (View Original)
 More options Jun 27 2012, 12:24 pm
From: balazs <bal...@czifra.net>
Date: Wed, 27 Jun 2012 09:24:06 -0700 (PDT)
Local: Wed, Jun 27 2012 12:24 pm
Subject: Re: [RavenDB] complex query parser

Hi Oren.  Thanks for your attention.  I've attached a vs 2012 solution that
contains one test, which fails.  I've included comments above the test that
will hopefully help you better understand the situation.  Thanks!

  CPQP.rar
314K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
balazs  
View profile   Translate to Translated (View Original)
 More options Jun 27 2012, 4:12 pm
From: balazs <bal...@czifra.net>
Date: Wed, 27 Jun 2012 13:12:01 -0700 (PDT)
Local: Wed, Jun 27 2012 4:12 pm
Subject: Re: [RavenDB] complex query parser

I'd been working off of build 888.  Upon using build 960 this problem seems
to have been resolved.  I'm not sure what changed, but it works so we can
leave it at that :)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Oren Eini (Ayende Rahien)  
View profile   Translate to Translated (View Original)
 More options Jun 27 2012, 4:13 pm
From: "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
Date: Wed, 27 Jun 2012 23:13:06 +0300
Local: Wed, Jun 27 2012 4:13 pm
Subject: Re: [RavenDB] complex query parser

okay, great


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »