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 Michael Jones <mi...@gmail.com> on 2012/12/10 09:27:21 UTC
multiple attribute
Hi,
I know that solr doesn't provide support for nested documents, but can I
add multiple attributes to a field?
<add>
<document>
<field name="test" foo="one" bar ="two" index="true">
And specify an index on those attributes?
I have a nested document that needs to be saved and searched.
If the above can not be achieved what would be a suitable alternative?
Would I have to do something like:
<add>
<document>
<field name="test" foo="one" bar ="two">
<field name="foo" index="true">one</field>
<field name="bar" index="true">two</field>
And just return name="test" ?
Thanks
Re: multiple attribute
Posted by Michael Jones <mi...@gmail.com>.
Hi,
Sorry if anyone found my question confusing.
I have an XML document that is nested
<file>
<foo>
<bar/>
<thunk/>
</foo>
</file>
And I know that with solr that you have to flatten your data, so I was just
trying to workout the best way to do a search on nested document. I was
looking to see if instead of having multiple nodes, I would have those
nodes as attributes on one single node and still be able to search.
So if my node looked like <field name="person" date="2000-01-01"
location="earth" username="bob" job="test" index="true" />
I would be able to search: date < 2002 & location = earth & job = test
But I'm not sure if that is the best way to do it? I know I would have to
specify a type for each attribute in the config.
On Mon, Dec 10, 2012 at 9:36 AM, Mikhail Khludnev <
mkhludnev@griddynamics.com> wrote:
> Michael,
>
> Your question is a little bit confusing. Business entities have attributes.
> We model entities as documents, and attributes as fields. That's why adding
> attributes to a filed is contradictory. Btw there few nearby conceptions in
> Lucene, which are Payloads and TermsPositions.
> About the problem itself I can suggest:
>
> - http://wiki.apache.org/solr/Join
> - http://wiki.apache.org/solr/FieldCollapsing - it supports faceting
> - block join
>
> http://blog.mikemccandless.com/2012/01/searching-relational-content-with.html
> https://issues.apache.org/jira/browse/SOLR-3076 - patch only but really
> performant
> - http://wiki.apache.org/solr/SurroundQueryParser available in 4.0 can
> be used by the way proposed here http://goo.gl/R2bxc video
> http://vimeo.com/album/2012142/video/33817062
>
> Have a good dive!
>
>
> On Mon, Dec 10, 2012 at 12:27 PM, Michael Jones <michaelj491@gmail.com
> >wrote:
>
> > Hi,
> >
> > I know that solr doesn't provide support for nested documents, but can I
> > add multiple attributes to a field?
> >
> > <add>
> > <document>
> > <field name="test" foo="one" bar ="two" index="true">
> >
> > And specify an index on those attributes?
> >
> > I have a nested document that needs to be saved and searched.
> >
> > If the above can not be achieved what would be a suitable alternative?
> >
> > Would I have to do something like:
> >
> > <add>
> > <document>
> > <field name="test" foo="one" bar ="two">
> > <field name="foo" index="true">one</field>
> > <field name="bar" index="true">two</field>
> >
> > And just return name="test" ?
> >
> > Thanks
> >
>
>
>
> --
> Sincerely yours
> Mikhail Khludnev
> Principal Engineer,
> Grid Dynamics
>
> <http://www.griddynamics.com>
> <mk...@griddynamics.com>
>
Re: multiple attribute
Posted by Mikhail Khludnev <mk...@griddynamics.com>.
Michael,
Your question is a little bit confusing. Business entities have attributes.
We model entities as documents, and attributes as fields. That's why adding
attributes to a filed is contradictory. Btw there few nearby conceptions in
Lucene, which are Payloads and TermsPositions.
About the problem itself I can suggest:
- http://wiki.apache.org/solr/Join
- http://wiki.apache.org/solr/FieldCollapsing - it supports faceting
- block join
http://blog.mikemccandless.com/2012/01/searching-relational-content-with.html
https://issues.apache.org/jira/browse/SOLR-3076 - patch only but really
performant
- http://wiki.apache.org/solr/SurroundQueryParser available in 4.0 can
be used by the way proposed here http://goo.gl/R2bxc video
http://vimeo.com/album/2012142/video/33817062
Have a good dive!
On Mon, Dec 10, 2012 at 12:27 PM, Michael Jones <mi...@gmail.com>wrote:
> Hi,
>
> I know that solr doesn't provide support for nested documents, but can I
> add multiple attributes to a field?
>
> <add>
> <document>
> <field name="test" foo="one" bar ="two" index="true">
>
> And specify an index on those attributes?
>
> I have a nested document that needs to be saved and searched.
>
> If the above can not be achieved what would be a suitable alternative?
>
> Would I have to do something like:
>
> <add>
> <document>
> <field name="test" foo="one" bar ="two">
> <field name="foo" index="true">one</field>
> <field name="bar" index="true">two</field>
>
> And just return name="test" ?
>
> Thanks
>
--
Sincerely yours
Mikhail Khludnev
Principal Engineer,
Grid Dynamics
<http://www.griddynamics.com>
<mk...@griddynamics.com>