You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by marc nicole <mk...@gmail.com> on 2023/01/26 21:22:15 UTC

How to create indexes for CSV dataset (with schema) in Java

Hello - I want to know how it is possible to create indexes for a certain
attribute (and its different values) of a document, using Java.

Thanks.

Re: How to create indexes for CSV dataset (with schema) in Java

Posted by marc nicole <mk...@gmail.com>.
I don't understand something,
does Solr make the indexing automatically when the data are injected into
it through a POST request (so that when querying the data from Solr (e.g.
through this query
http://localhost:8983/solr/#/books/query?q=*:*&fq=price:%5B7%20TO%20*%5D)
the query is achieved faster)? or do I have to define some indexing
operations over the data attributes?

Le ven. 27 janv. 2023 à 15:06, Jan Høydahl <ja...@cominvent.com> a écrit :

> Start Solr
> bin/solr start -c
>
> Create collection
> bin/solr create -c books
>
> Inject some CVS data:
> https://github.com/apache/solr/blob/main/solr/example/exampledocs/books.csv
> bin/post
> <https://github.com/apache/solr/blob/main/solr/example/exampledocs/books.csvbin/post>
> -c books example/exampledocs/books.csv
>
> Query to see only books with price from $7:
> http://localhost:8983/solr/#/books/query?q=*:*&fq=price:%5B7%20TO%20*%5D
>
> You could of course query this from Java using our SolrJ client library.
>
> Perhaps that is a starting point for you to formulate in a better way what
> you are trying to achieve?
>
> Jan
>
> > 27. jan. 2023 kl. 08:38 skrev marc nicole <mk...@gmail.com>:
> >
> > In, java i want to create index of a collection named person and say an
> > "Age" attribute for the values between 20 and 35. so that when i query
> Solr
> > on those values it retrieves them quickly how to do that ?
> >
> > Le ven. 27 janv. 2023 à 03:42, Shawn Heisey <ap...@elyograg.org> a
> écrit :
> >
> >> On 1/26/2023 2:22 PM, marc nicole wrote:
> >>> Hello - I want to know how it is possible to create indexes for a
> certain
> >>> attribute (and its different values) of a document, using Java.
> >>
> >> This is a pretty vague question.  We need details of exactly what you're
> >> trying to do and what the environment looks like.
> >>
> >> Thanks,
> >> Shawn
> >>
> >>
>
>

Re: How to create indexes for CSV dataset (with schema) in Java

Posted by Jan Høydahl <ja...@cominvent.com>.
Start Solr
bin/solr start -c

Create collection
bin/solr create -c books

Inject some CVS data: https://github.com/apache/solr/blob/main/solr/example/exampledocs/books.csv
bin/post -c books example/exampledocs/books.csv

Query to see only books with price from $7:
http://localhost:8983/solr/#/books/query?q=*:*&fq=price:%5B7%20TO%20*%5D

You could of course query this from Java using our SolrJ client library.

Perhaps that is a starting point for you to formulate in a better way what you are trying to achieve?

Jan

> 27. jan. 2023 kl. 08:38 skrev marc nicole <mk...@gmail.com>:
> 
> In, java i want to create index of a collection named person and say an
> "Age" attribute for the values between 20 and 35. so that when i query Solr
> on those values it retrieves them quickly how to do that ?
> 
> Le ven. 27 janv. 2023 à 03:42, Shawn Heisey <ap...@elyograg.org> a écrit :
> 
>> On 1/26/2023 2:22 PM, marc nicole wrote:
>>> Hello - I want to know how it is possible to create indexes for a certain
>>> attribute (and its different values) of a document, using Java.
>> 
>> This is a pretty vague question.  We need details of exactly what you're
>> trying to do and what the environment looks like.
>> 
>> Thanks,
>> Shawn
>> 
>> 


Re: How to create indexes for CSV dataset (with schema) in Java

Posted by marc nicole <mk...@gmail.com>.
In, java i want to create index of a collection named person and say an
"Age" attribute for the values between 20 and 35. so that when i query Solr
on those values it retrieves them quickly how to do that ?

Le ven. 27 janv. 2023 à 03:42, Shawn Heisey <ap...@elyograg.org> a écrit :

> On 1/26/2023 2:22 PM, marc nicole wrote:
> > Hello - I want to know how it is possible to create indexes for a certain
> > attribute (and its different values) of a document, using Java.
>
> This is a pretty vague question.  We need details of exactly what you're
> trying to do and what the environment looks like.
>
> Thanks,
> Shawn
>
>

Re: How to create indexes for CSV dataset (with schema) in Java

Posted by Shawn Heisey <ap...@elyograg.org>.
On 1/26/2023 2:22 PM, marc nicole wrote:
> Hello - I want to know how it is possible to create indexes for a certain
> attribute (and its different values) of a document, using Java.

This is a pretty vague question.  We need details of exactly what you're 
trying to do and what the environment looks like.

Thanks,
Shawn