You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Jamie Johnson <je...@gmail.com> on 2011/06/27 23:15:05 UTC

TermVectors and custom queries

I have a field named content with the following definition

   <field name="content" type="text" indexed="true" stored="true"
multiValued="true" termVectors="true" termPositions="true"
termOffsets="true"/>

I'm now trying to execute a query against content and get back the term
vectors for the pieces that matched my query, but I must be messing
something up.  My query is as follows:

http://localhost:8983/solr/select/?qt=tvrh&q=content:test&fl=content&tv.all=true

where the word test is in my content field.  When I get information back
though I am getting the term vectors for all of the tokens in that field.
How do I get back just the ones that match my search?

Re: TermVectors and custom queries

Posted by Mike Sokolov <so...@ifactory.com>.
Yes, that's right.  But at the moment the HL code basically has to 
reconstruct and re-run your query - it doesn't have any special 
knowledge.  There's some work going on to try and fix that, but it seems 
like it's going to require some fairly major deep re-plumbing.

-Mike

On 07/01/2011 07:54 AM, Jamie Johnson wrote:
> How would I know which ones were the ones I wanted?  I don't see how
> from a query I couldn't match up the term vectors that met the query.
> Seems like what needs to be done is have the highlighting on the solr
> end where you have more access to the information I'm looking for.
> Sound about right?
>
> On Fri, Jul 1, 2011 at 7:26 AM, Michael Sokolov<so...@ifactory.com>  wrote:
>    
>> I think that's all you can do, although there is a callback-style interface
>> that might save some time (or space).  You still need to iterate over all of
>> the vectors, at least until you get the one you want.
>>
>> -Mike
>>
>> On 6/30/2011 4:53 PM, Jamie Johnson wrote:
>>      
>>> Perhaps a better question, is this possible?
>>>
>>> On Mon, Jun 27, 2011 at 5:15 PM, Jamie Johnson<je...@gmail.com>    wrote:
>>>        
>>>> I have a field named content with the following definition
>>>>
>>>>     <field name="content" type="text" indexed="true" stored="true"
>>>> multiValued="true" termVectors="true" termPositions="true"
>>>> termOffsets="true"/>
>>>>
>>>> I'm now trying to execute a query against content and get back the term
>>>> vectors for the pieces that matched my query, but I must be messing
>>>> something up.  My query is as follows:
>>>>
>>>>
>>>> http://localhost:8983/solr/select/?qt=tvrh&q=content:test&fl=content&tv.all=true
>>>>
>>>> where the word test is in my content field.  When I get information back
>>>> though I am getting the term vectors for all of the tokens in that field.
>>>> How do I get back just the ones that match my search?
>>>>
>>>>          
>>
>>      

Re: TermVectors and custom queries

Posted by Jamie Johnson <je...@gmail.com>.
How would I know which ones were the ones I wanted?  I don't see how
from a query I couldn't match up the term vectors that met the query.
Seems like what needs to be done is have the highlighting on the solr
end where you have more access to the information I'm looking for.
Sound about right?

On Fri, Jul 1, 2011 at 7:26 AM, Michael Sokolov <so...@ifactory.com> wrote:
> I think that's all you can do, although there is a callback-style interface
> that might save some time (or space).  You still need to iterate over all of
> the vectors, at least until you get the one you want.
>
> -Mike
>
> On 6/30/2011 4:53 PM, Jamie Johnson wrote:
>>
>> Perhaps a better question, is this possible?
>>
>> On Mon, Jun 27, 2011 at 5:15 PM, Jamie Johnson<je...@gmail.com>  wrote:
>>>
>>> I have a field named content with the following definition
>>>
>>>    <field name="content" type="text" indexed="true" stored="true"
>>> multiValued="true" termVectors="true" termPositions="true"
>>> termOffsets="true"/>
>>>
>>> I'm now trying to execute a query against content and get back the term
>>> vectors for the pieces that matched my query, but I must be messing
>>> something up.  My query is as follows:
>>>
>>>
>>> http://localhost:8983/solr/select/?qt=tvrh&q=content:test&fl=content&tv.all=true
>>>
>>> where the word test is in my content field.  When I get information back
>>> though I am getting the term vectors for all of the tokens in that field.
>>> How do I get back just the ones that match my search?
>>>
>
>

Re: TermVectors and custom queries

Posted by Michael Sokolov <so...@ifactory.com>.
I think that's all you can do, although there is a callback-style 
interface that might save some time (or space).  You still need to 
iterate over all of the vectors, at least until you get the one you want.

-Mike

On 6/30/2011 4:53 PM, Jamie Johnson wrote:
> Perhaps a better question, is this possible?
>
> On Mon, Jun 27, 2011 at 5:15 PM, Jamie Johnson<je...@gmail.com>  wrote:
>> I have a field named content with the following definition
>>
>>     <field name="content" type="text" indexed="true" stored="true"
>> multiValued="true" termVectors="true" termPositions="true"
>> termOffsets="true"/>
>>
>> I'm now trying to execute a query against content and get back the term
>> vectors for the pieces that matched my query, but I must be messing
>> something up.  My query is as follows:
>>
>> http://localhost:8983/solr/select/?qt=tvrh&q=content:test&fl=content&tv.all=true
>>
>> where the word test is in my content field.  When I get information back
>> though I am getting the term vectors for all of the tokens in that field.
>> How do I get back just the ones that match my search?
>>


Re: TermVectors and custom queries

Posted by Jamie Johnson <je...@gmail.com>.
Perhaps a better question, is this possible?

On Mon, Jun 27, 2011 at 5:15 PM, Jamie Johnson <je...@gmail.com> wrote:
> I have a field named content with the following definition
>
>    <field name="content" type="text" indexed="true" stored="true"
> multiValued="true" termVectors="true" termPositions="true"
> termOffsets="true"/>
>
> I'm now trying to execute a query against content and get back the term
> vectors for the pieces that matched my query, but I must be messing
> something up.  My query is as follows:
>
> http://localhost:8983/solr/select/?qt=tvrh&q=content:test&fl=content&tv.all=true
>
> where the word test is in my content field.  When I get information back
> though I am getting the term vectors for all of the tokens in that field.
> How do I get back just the ones that match my search?
>