Re: how to do a Parent/Child Mapping using entities

2010-01-02 Thread Lance Norskog
[Ryan McKinley] For starters, the order of multi-valued fields should
be maintained, so if you have:

Wait! I thougt documents and fields are sets in the Lucene index -
order is not preserved.

On Thu, Dec 31, 2009 at 7:47 PM, Chris Hostetter
hossman_luc...@fucit.org wrote:

 : You could easily write your own query parser (QParserPlugin, in Solr's
 : terminology) that internally translates queries like
 :
 :        q = res_url:url AND res_rank:rank
 :
 : into
 :       q = res_ranked_url:rank url
 :
 : thus hiding the res_ranked_url field from the user/client.
 :
 : I'm not sure, but maybe it's possible to utilize the order of values within
 : the multi-valued field res_url directly in the newly created parser. This

 It is possible to use SpanMaskingQuery ... it lets you build a
 SpanNearQuery that requires a match in one field to be near a match in
 another field (ie: at the same position, or within some amount of slop)

 so then you could find all docs where url:A and rank:2 both occur at
 the same position (in a multi-valued field) but SpanQueries don't play
 nicely with range queries, so you wouldn't be able to find docs where
 url:A and rank:[* TO 5] at the same position.



 -Hoss





-- 
Lance Norskog
goks...@gmail.com


Re: how to do a Parent/Child Mapping using entities

2009-12-31 Thread Chris Hostetter

: You could easily write your own query parser (QParserPlugin, in Solr's
: terminology) that internally translates queries like
: 
:q = res_url:url AND res_rank:rank
: 
: into
:   q = res_ranked_url:rank url
: 
: thus hiding the res_ranked_url field from the user/client.
: 
: I'm not sure, but maybe it's possible to utilize the order of values within
: the multi-valued field res_url directly in the newly created parser. This

It is possible to use SpanMaskingQuery ... it lets you build a 
SpanNearQuery that requires a match in one field to be near a match in 
another field (ie: at the same position, or within some amount of slop)

so then you could find all docs where url:A and rank:2 both occur at 
the same position (in a multi-valued field) but SpanQueries don't play 
nicely with range queries, so you wouldn't be able to find docs where 
url:A and rank:[* TO 5] at the same position.



-Hoss



Re: how to do a Parent/Child Mapping using entities

2009-12-30 Thread magui

Thanks Sascha for your post, but i find it interresting, but in my case i
don't want to use an additionnal field, i want to be able with the same
schema to do a simple query like : q=res_url:some url, and a query like
the other one;
in other word; is there any solution to make two or more multivalued fields
in the same document linked with each other, e.g:
in this result:

- result name=response numFound=1 start=0
- doc
  str name=id1/str
  str name=keywordKey1/str
- arr name=res_url
  strurl1/str
  strurl2/str
  strurl3/str
  strurl4/str
  /arr
- arr name=res_rank
  str1/str
  str2/str
  str3/str
  str4/str
  /arr
  /doc
  /result 

i would like to make solr understand that for this document, value:url1 of
res_url field is linked to value:1 of res_rank field, and all of them
are linked to the commen field keyword.
I think that i should use a custom field analyser or some thing like that;
but i don't know what to do.

but thanks for all; and any supplied help will be lovable.


Sascha Szott wrote:
 
 Hi,
 
 you could create an additional index field res_ranked_url that contains 
 the concatenated value of an url and its corresponding rank, e.g.,
   
   res_rank +   + res_url
 
 Then, q=res_ranked_url:1 url1 retrieves all documents with url1 as the 
 first url.
 
 A drawback of this workaround is that you have to use a phrase query 
 thus preventing wildcard searches for urls.
 
 -Sascha
 

 Hello everybody, i would like to know how to create index supporting a
 parent/child mapping and then querying the child to get the results.
 in other words; imagine that we have a database containing 2
 tables:Keyword[id(int), value(string)] and Result[id(int), res_url(text),
 res_text(tex), res_date(date), res_rank(int)]
 For indexing, i used the DataImportHandler to import data and it works
 well,
 and my query response seems good:(q=*:*) (imagine that we have only this
 to
 keywords and their results)

?xml version=1.0 encoding=UTF-8 ?
 -response
 -lst name=responseHeader
int name=status0/int
int name=QTime0/int
 -lst name=params
str name=q*:*/str
/lst
/lst
 -result name=response numFound=2 start=0
 -doc
str name=id1/str
str name=keywordKey1/str
 -arr name=res_url
strurl1/str
strurl2/str
strurl3/str
strurl4/str
/arr
 -arr name=res_rank
str1/str
str2/str
str3/str
str4/str
/arr
/doc
 -doc
str name=id2/str
str name=keywordKey2/str
 -arr name=res_url
strurl1/str
strurl5/str
strurl8/str
strurl7/str
/arr
 -arr name=res_rank
str1/str
str2/str
str3/str
str4/str
/arr
/doc
/result
/response

 but the problem is when i tape a query kind of this:q=res_url:url2 AND
 res_rank:1 and this to say that i want to search for the keywords in
 which
 the url (url2) is ranked at the first position, i have a result like
 this:

 ?xml version=1.0 encoding=UTF-8 ?
 -response
 -lst name=responseHeader
int name=status0/int
int name=QTime0/int
 -lst name=params
str name=qres_url:url2 AND res_rank:1/str
/lst
/lst
 -result name=response numFound=1 start=0
 -doc
str name=id1/str
str name=keywordKey1/str
 -arr name=res_url
strurl1/str
strurl2/str
strurl3/str
strurl4/str
/arr
 -arr name=res_rank
str1/str
str2/str
str3/str
str4/str
/arr
/doc
/result
/response

 But this is not true; because the url present in the 1st position in the
 results of the keyword key1 is url1 and not url2.
 So what i want to say is : is there any solution to make the values of
 the
 multivalued fields linked;
 so in our case we can see that the previous result say that:
   - url1 is present in 1st position of key1 results
   - url2 is present in 2nd position of key1 results
   - url3 is present in 3rd position of key1 results
   - url4 is present in 4th position of key1 results

 and i would like that solr consider this when executing queries.

 Any helps please; and thanks for all :)
 
 
 

-- 
View this message in context: 
http://old.nabble.com/how-to-do-a-Parent-Child-Mapping-using-entities-tp26956426p26965478.html
Sent from the Solr - User mailing list archive at Nabble.com.



Re: how to do a Parent/Child Mapping using entities

2009-12-30 Thread Ryan McKinley

Ya, structured data gets a little funny.

For starters, the order of multi-valued fields should be maintained,  
so if you have:


doc
 field name=urlhttp://aaa/field
 field name=url_rank5/field
 field name=urlhttp://bbb/field
 field name=url_rank4/field
/doc

the response will return result in order, so you can map them with  
array indicies.


I have played some tricks with a JSON field analyzer that give you  
some more control.


For example, if you index:

doc
 field name=url{ url:http://host/;, rank:5 }/field
/doc

Then I use an analyzer that indexes the terms:
  url:http://host/
  rank:5

I just posted SOLR-1690, if you want to take a look at that approach

ryan


On Dec 30, 2009, at 4:25 AM, magui wrote:



Thanks Sascha for your post, but i find it interresting, but in my  
case i
don't want to use an additionnal field, i want to be able with the  
same
schema to do a simple query like : q=res_url:some url, and a query  
like

the other one;
in other word; is there any solution to make two or more multivalued  
fields

in the same document linked with each other, e.g:
in this result:

- result name=response numFound=1 start=0
- doc
 str name=id1/str
 str name=keywordKey1/str
- arr name=res_url
 strurl1/str
 strurl2/str
 strurl3/str
 strurl4/str
 /arr
- arr name=res_rank
 str1/str
 str2/str
 str3/str
 str4/str
 /arr
 /doc
 /result

i would like to make solr understand that for this document,  
value:url1 of
res_url field is linked to value:1 of res_rank field, and all of  
them

are linked to the commen field keyword.
I think that i should use a custom field analyser or some thing like  
that;

but i don't know what to do.

but thanks for all; and any supplied help will be lovable.


Sascha Szott wrote:


Hi,

you could create an additional index field res_ranked_url that  
contains

the concatenated value of an url and its corresponding rank, e.g.,

res_rank +   + res_url

Then, q=res_ranked_url:1 url1 retrieves all documents with url1  
as the

first url.

A drawback of this workaround is that you have to use a phrase query
thus preventing wildcard searches for urls.

-Sascha



Hello everybody, i would like to know how to create index  
supporting a

parent/child mapping and then querying the child to get the results.
in other words; imagine that we have a database containing 2
tables:Keyword[id(int), value(string)] and Result[id(int),  
res_url(text),

res_text(tex), res_date(date), res_rank(int)]
For indexing, i used the DataImportHandler to import data and it  
works

well,
and my query response seems good:(q=*:*) (imagine that we have  
only this

to
keywords and their results)

  ?xml version=1.0 encoding=UTF-8 ?
-response
-lst name=responseHeader
  int name=status0/int
  int name=QTime0/int
-lst name=params
  str name=q*:*/str
  /lst
  /lst
-result name=response numFound=2 start=0
-doc
  str name=id1/str
  str name=keywordKey1/str
-arr name=res_url
  strurl1/str
  strurl2/str
  strurl3/str
  strurl4/str
  /arr
-arr name=res_rank
  str1/str
  str2/str
  str3/str
  str4/str
  /arr
  /doc
-doc
  str name=id2/str
  str name=keywordKey2/str
-arr name=res_url
  strurl1/str
  strurl5/str
  strurl8/str
  strurl7/str
  /arr
-arr name=res_rank
  str1/str
  str2/str
  str3/str
  str4/str
  /arr
  /doc
  /result
  /response

but the problem is when i tape a query kind of  
this:q=res_url:url2 AND
res_rank:1 and this to say that i want to search for the keywords  
in

which
the url (url2) is ranked at the first position, i have a result like
this:

?xml version=1.0 encoding=UTF-8 ?
-response
-lst name=responseHeader
  int name=status0/int
  int name=QTime0/int
-lst name=params
  str name=qres_url:url2 AND res_rank:1/str
  /lst
  /lst
-result name=response numFound=1 start=0
-doc
  str name=id1/str
  str name=keywordKey1/str
-arr name=res_url
  strurl1/str
  strurl2/str
  strurl3/str
  strurl4/str
  /arr
-arr name=res_rank
  str1/str
  str2/str
  str3/str
  str4/str
  /arr
  /doc
  /result
  /response

But this is not true; because the url present in the 1st position  
in the

results of the keyword key1 is url1 and not url2.
So what i want to say is : is there any solution to make the  
values of

the
multivalued fields linked;
so in our case we can see that the previous result say that:
 - url1 is present in 1st position of key1 results
 - url2 is present in 2nd position of key1 results
 - url3 is present in 3rd position of key1 results
 - url4 is present in 4th position of key1 results

and i would like that solr consider this when executing queries.

Any helps please; and thanks for all :)






--
View this message in context: 
http://old.nabble.com/how-to-do-a-Parent-Child-Mapping-using-entities-tp26956426p26965478.html
Sent from the Solr - User mailing list archive at Nabble.com.





Re: how to do a Parent/Child Mapping using entities

2009-12-30 Thread Sascha Szott

Hi,


Thanks Sascha for your post, but i find it interresting, but in my case i
don't want to use an additionnal field, i want to be able with the same
schema to do a simple query like : q=res_url:some url, and a query like
the other one;
You could easily write your own query parser (QParserPlugin, in Solr's 
terminology) that internally translates queries like


 q = res_url:url AND res_rank:rank

into
q = res_ranked_url:rank url

thus hiding the res_ranked_url field from the user/client.

I'm not sure, but maybe it's possible to utilize the order of values 
within the multi-valued field res_url directly in the newly created 
parser. This seems like the cleanest solution to me.


-Sascha


in other word; is there any solution to make two or more multivalued fields
in the same document linked with each other, e.g:
in this result:

-result name=response numFound=1 start=0
-doc
   str name=id1/str
   str name=keywordKey1/str
-arr name=res_url
   strurl1/str
   strurl2/str
   strurl3/str
   strurl4/str
   /arr
-arr name=res_rank
   str1/str
   str2/str
   str3/str
   str4/str
   /arr
   /doc
   /result

i would like to make solr understand that for this document, value:url1 of
res_url field is linked to value:1 of res_rank field, and all of them
are linked to the commen field keyword.
I think that i should use a custom field analyser or some thing like that;
but i don't know what to do.

but thanks for all; and any supplied help will be lovable.


Sascha Szott wrote:


Hi,

you could create an additional index field res_ranked_url that contains
the concatenated value of an url and its corresponding rank, e.g.,

res_rank +   + res_url

Then, q=res_ranked_url:1 url1 retrieves all documents with url1 as the
first url.

A drawback of this workaround is that you have to use a phrase query
thus preventing wildcard searches for urls.

-Sascha



Hello everybody, i would like to know how to create index supporting a
parent/child mapping and then querying the child to get the results.
in other words; imagine that we have a database containing 2
tables:Keyword[id(int), value(string)] and Result[id(int), res_url(text),
res_text(tex), res_date(date), res_rank(int)]
For indexing, i used the DataImportHandler to import data and it works
well,
and my query response seems good:(q=*:*) (imagine that we have only this
to
keywords and their results)

?xml version=1.0 encoding=UTF-8 ?
-response
-lst name=responseHeader
int name=status0/int
int name=QTime0/int
-lst name=params
str name=q*:*/str
/lst
/lst
-result name=response numFound=2 start=0
-doc
str name=id1/str
str name=keywordKey1/str
-arr name=res_url
strurl1/str
strurl2/str
strurl3/str
strurl4/str
/arr
-arr name=res_rank
str1/str
str2/str
str3/str
str4/str
/arr
/doc
-doc
str name=id2/str
str name=keywordKey2/str
-arr name=res_url
strurl1/str
strurl5/str
strurl8/str
strurl7/str
/arr
-arr name=res_rank
str1/str
str2/str
str3/str
str4/str
/arr
/doc
/result
/response

but the problem is when i tape a query kind of this:q=res_url:url2 AND
res_rank:1 and this to say that i want to search for the keywords in
which
the url (url2) is ranked at the first position, i have a result like
this:

?xml version=1.0 encoding=UTF-8 ?
-response
-lst name=responseHeader
int name=status0/int
int name=QTime0/int
-lst name=params
str name=qres_url:url2 AND res_rank:1/str
/lst
/lst
-result name=response numFound=1 start=0
-doc
str name=id1/str
str name=keywordKey1/str
-arr name=res_url
strurl1/str
strurl2/str
strurl3/str
strurl4/str
/arr
-arr name=res_rank
str1/str
str2/str
str3/str
str4/str
/arr
/doc
/result
/response

But this is not true; because the url present in the 1st position in the
results of the keyword key1 is url1 and not url2.
So what i want to say is : is there any solution to make the values of
the
multivalued fields linked;
so in our case we can see that the previous result say that:
   - url1 is present in 1st position of key1 results
   - url2 is present in 2nd position of key1 results
   - url3 is present in 3rd position of key1 results
   - url4 is present in 4th position of key1 results

and i would like that solr consider this when executing queries.

Any helps please; and thanks for all :)







how to do a Parent/Child Mapping using entities

2009-12-29 Thread magui

Hello everybody, i would like to know how to create index supporting a
parent/child mapping and then querying the child to get the results.
in other words; imagine that we have a database containing 2
tables:Keyword[id(int), value(string)] and Result[id(int), res_url(text),
res_text(tex), res_date(date), res_rank(int)]
For indexing, i used the DataImportHandler to import data and it works well,
and my query response seems good:(q=*:*) (imagine that we have only this to
keywords and their results)

  ?xml version=1.0 encoding=UTF-8 ? 
- response
- lst name=responseHeader
  int name=status0/int 
  int name=QTime0/int 
- lst name=params
  str name=q*:*/str 
  /lst
  /lst
- result name=response numFound=2 start=0
- doc
  str name=id1/str 
  str name=keywordKey1/str 
- arr name=res_url
  strurl1/str 
  strurl2/str 
  strurl3/str 
  strurl4/str 
  /arr
- arr name=res_rank
  str1/str 
  str2/str 
  str3/str
  str4/str
  /arr
  /doc
- doc
  str name=id2/str 
  str name=keywordKey2/str 
- arr name=res_url
  strurl1/str 
  strurl5/str 
  strurl8/str 
  strurl7/str 
  /arr
- arr name=res_rank
  str1/str 
  str2/str 
  str3/str
  str4/str
  /arr
  /doc
  /result
  /response

but the problem is when i tape a query kind of this:q=res_url:url2 AND
res_rank:1 and this to say that i want to search for the keywords in which
the url (url2) is ranked at the first position, i have a result like this:

?xml version=1.0 encoding=UTF-8 ? 
- response
- lst name=responseHeader
  int name=status0/int 
  int name=QTime0/int 
- lst name=params
  str name=qres_url:url2 AND res_rank:1/str 
  /lst
  /lst
- result name=response numFound=1 start=0
- doc
  str name=id1/str 
  str name=keywordKey1/str 
- arr name=res_url
  strurl1/str 
  strurl2/str 
  strurl3/str 
  strurl4/str 
  /arr
- arr name=res_rank
  str1/str 
  str2/str 
  str3/str
  str4/str
  /arr
  /doc
  /result
  /response

But this is not true; because the url present in the 1st position in the
results of the keyword key1 is url1 and not url2.
So what i want to say is : is there any solution to make the values of the
multivalued fields linked; 
so in our case we can see that the previous result say that:
 - url1 is present in 1st position of key1 results
 - url2 is present in 2nd position of key1 results
 - url3 is present in 3rd position of key1 results
 - url4 is present in 4th position of key1 results

and i would like that solr consider this when executing queries.

Any helps please; and thanks for all :)
-- 
View this message in context: 
http://old.nabble.com/how-to-do-a-Parent-Child-Mapping-using-entities-tp26956426p26956426.html
Sent from the Solr - User mailing list archive at Nabble.com.



Re: how to do a Parent/Child Mapping using entities

2009-12-29 Thread Sascha Szott

Hi,

you could create an additional index field res_ranked_url that contains 
the concatenated value of an url and its corresponding rank, e.g.,


res_rank +   + res_url

Then, q=res_ranked_url:1 url1 retrieves all documents with url1 as the 
first url.


A drawback of this workaround is that you have to use a phrase query 
thus preventing wildcard searches for urls.


-Sascha



Hello everybody, i would like to know how to create index supporting a
parent/child mapping and then querying the child to get the results.
in other words; imagine that we have a database containing 2
tables:Keyword[id(int), value(string)] and Result[id(int), res_url(text),
res_text(tex), res_date(date), res_rank(int)]
For indexing, i used the DataImportHandler to import data and it works well,
and my query response seems good:(q=*:*) (imagine that we have only this to
keywords and their results)

   ?xml version=1.0 encoding=UTF-8 ?
-response
-lst name=responseHeader
   int name=status0/int
   int name=QTime0/int
-lst name=params
   str name=q*:*/str
   /lst
   /lst
-result name=response numFound=2 start=0
-doc
   str name=id1/str
   str name=keywordKey1/str
-arr name=res_url
   strurl1/str
   strurl2/str
   strurl3/str
   strurl4/str
   /arr
-arr name=res_rank
   str1/str
   str2/str
   str3/str
   str4/str
   /arr
   /doc
-doc
   str name=id2/str
   str name=keywordKey2/str
-arr name=res_url
   strurl1/str
   strurl5/str
   strurl8/str
   strurl7/str
   /arr
-arr name=res_rank
   str1/str
   str2/str
   str3/str
   str4/str
   /arr
   /doc
   /result
   /response

but the problem is when i tape a query kind of this:q=res_url:url2 AND
res_rank:1 and this to say that i want to search for the keywords in which
the url (url2) is ranked at the first position, i have a result like this:

?xml version=1.0 encoding=UTF-8 ?
-response
-lst name=responseHeader
   int name=status0/int
   int name=QTime0/int
-lst name=params
   str name=qres_url:url2 AND res_rank:1/str
   /lst
   /lst
-result name=response numFound=1 start=0
-doc
   str name=id1/str
   str name=keywordKey1/str
-arr name=res_url
   strurl1/str
   strurl2/str
   strurl3/str
   strurl4/str
   /arr
-arr name=res_rank
   str1/str
   str2/str
   str3/str
   str4/str
   /arr
   /doc
   /result
   /response

But this is not true; because the url present in the 1st position in the
results of the keyword key1 is url1 and not url2.
So what i want to say is : is there any solution to make the values of the
multivalued fields linked;
so in our case we can see that the previous result say that:
  - url1 is present in 1st position of key1 results
  - url2 is present in 2nd position of key1 results
  - url3 is present in 3rd position of key1 results
  - url4 is present in 4th position of key1 results

and i would like that solr consider this when executing queries.

Any helps please; and thanks for all :)