Mailing List Archive

Lucene one to many query
Hi everyone. I am trying to build a lucene query that will work with the
following one-to-many relationship. I’m trying to-do this in lucene 5.5 but
if i can’t then i’ll move towards upgrading the project to a newer version
if necessary.

Say i have two objects like so. One Company that has multiple Items.

-------------
*Company* (one)
String name
String address_state
String address_street
...
Items items
-----------------

-----------------
*Items* (many)
Int item_id
String item_name
...
Int item_price
-----------------

How would i do a search for Companies in a particular state that have a
particular item name with a price below a certain point? For instance,
search for companies that are in CA with an item named “Phone” that also
have a price below 150?

I only have around 300k companies but have around 5 million items. So id
rather first filter by company if possible.

To anyone out there, thanks.






--
Sent from: https://lucene.472066.n3.nabble.com/Lucene-Java-Users-f532864.html

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Lucene one to many query [ In reply to ]
Hi everyone. I am trying to build a lucene query that will work with the
following one-to-many relationship. I’m trying to-do this in lucene 5.5 but
if i can’t then i’ll move towards upgrading the project to a newer version
if necessary.

Say i have two objects like so. One Company that has multiple Items.

-------------
*Company* (one)
String name
String address_state
String address_street
...
Items items
-----------------

-----------------
*Items* (many)
Int item_id
String item_name
...
Int item_price
-----------------

How would i do a search for Companies in a particular state that have a
particular item name with a price below a certain point? For instance,
search for companies that are in CA with an item named “Phone” that also
have a price below 150?

I only have around 300k companies but have around 5 million items. So id
rather first filter by company if possible.

To anyone out there, thanks.






--
Sent from: https://lucene.472066.n3.nabble.com/Lucene-Java-Users-f532864.html

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Lucene one to many query [ In reply to ]
Nested documents structure supported by solr is what you need.

But as you are using lucene, you should denormalize and store item with
company fields and price.

Apply search on item with function query on item_price.

As you have results you can store companies in a set.

On Sat, Sep 21, 2019, 11:14 AM ncs88 <ns533@njit.edu> wrote:

> Hi everyone. I am trying to build a lucene query that will work with the
> following one-to-many relationship. I’m trying to-do this in lucene 5.5 but
> if i can’t then i’ll move towards upgrading the project to a newer version
> if necessary.
>
> Say i have two objects like so. One Company that has multiple Items.
>
> -------------
> *Company* (one)
> String name
> String address_state
> String address_street
> ...
> Items items
> -----------------
>
> -----------------
> *Items* (many)
> Int item_id
> String item_name
> ...
> Int item_price
> -----------------
>
> How would i do a search for Companies in a particular state that have a
> particular item name with a price below a certain point? For instance,
> search for companies that are in CA with an item named “Phone” that also
> have a price below 150?
>
> I only have around 300k companies but have around 5 million items. So id
> rather first filter by company if possible.
>
> To anyone out there, thanks.
>
>
>
>
>
>
> --
> Sent from:
> https://lucene.472066.n3.nabble.com/Lucene-Java-Users-f532864.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
Re: Lucene one to many query [ In reply to ]
Hi,

see ToParentBlockJoinQuery

On Sat, Sep 21, 2019 at 6:14 PM ncs88 <ns533@njit.edu> wrote:

> Hi everyone. I am trying to build a lucene query that will work with the
> following one-to-many relationship. I’m trying to-do this in lucene 5.5 but
> if i can’t then i’ll move towards upgrading the project to a newer version
> if necessary.
>
> Say i have two objects like so. One Company that has multiple Items.
>
> -------------
> *Company* (one)
> String name
> String address_state
> String address_street
> ...
> Items items
> -----------------
>
> -----------------
> *Items* (many)
> Int item_id
> String item_name
> ...
> Int item_price
> -----------------
>
> How would i do a search for Companies in a particular state that have a
> particular item name with a price below a certain point? For instance,
> search for companies that are in CA with an item named “Phone” that also
> have a price below 150?
>
> I only have around 300k companies but have around 5 million items. So id
> rather first filter by company if possible.
>
> To anyone out there, thanks.
>
>
>
>
>
>
> --
> Sent from:
> https://lucene.472066.n3.nabble.com/Lucene-Java-Users-f532864.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

--
Sincerely yours
Mikhail Khludnev
Lucene one to many query [ In reply to ]
Hi everyone. I am trying to build a lucene query that will work with the
following one-to-many relationship. I’m trying to-do this in lucene 5.5 but
if i can’t then i’ll move towards upgrading the project to a newer version
if necessary.

Say i have two objects like so. One Company that has multiple Items.

-------------
*Company* (one)
String name
String address_state
String address_street
...
Items items
-----------------

-----------------
*Items* (many)
Int item_id
String item_name
...
Int item_price
-----------------

How would i do a search for Companies in a particular state that have a
particular item name with a price below a certain point? For instance,
search for companies that are in CA with an item named “Phone” that also
have a price below 150?

I only have around 300k companies but have around 5 million items. So id
rather first filter by company if possible.

To anyone out there, thanks.






--
Sent from: https://lucene.472066.n3.nabble.com/Lucene-Java-Users-f532864.html

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org