Re: Stemming words Using Solr

2015-09-04 Thread Ritesh Sinha
This is the code which i have written to get the stemmed word.

public class URLConnectionReader {
public static void main(String[] args) throws Exception {
URL solr = new URL(
"http://localhost:8983/solr/
"+args[0]+"/analysis/field?wt=json=true="+args[1]+"="+args[2]+"");
URLConnection sl = solr.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(
sl.getInputStream()));
String inputLine;
StringBuilder sb = new StringBuilder();
while ((inputLine = in.readLine()) != null) {
sb.append(inputLine);
}

in.close();

JSONObject obj = new JSONObject(sb.toString());
JSONArray analysis = obj.getJSONObject("analysis")
.getJSONObject("field_types").getJSONObject(args[2])
.getJSONArray("query");

JSONArray jsonarray = new JSONArray(analysis.toString());
ArrayList stemmedWords = new ArrayList();
for (int i = 0; i < jsonarray.length(); i++) {
String objF = jsonarray.getString(i);
stemmedWords.add(objF);
}

String lastStemmedGroup = stemmedWords.get(stemmedWords.size() -
1).toString();

JSONArray finalStemmer = new JSONArray(lastStemmedGroup);

for (int i = 0; i < finalStemmer.length(); i++) {
JSONObject jsonobject = finalStemmer.getJSONObject(i);
String stemmedWord = jsonobject.getString("text");
System.out.println(stemmedWord);
}

}

}


Here, args[0] is core.
args[1] is the word i'll be sending for stemming.
args[2] is the Analyse Fieldname / FieldType.

I am looking into FieldAnalysisRequest.
Do you have some code snippet or something which can guide me ?

Thanks

On Fri, Sep 4, 2015 at 12:44 PM, Upayavira  wrote:

> Yes, look at the one I mentioned further up in this thread, which is a
> part of SolrJ: FieldAnalysisRequest
>
> That uses the same HTTP call in the backend, but formats the result in a
> Java friendly manner.
>
> Upayavira
>
> On Fri, Sep 4, 2015, at 05:52 AM, Ritesh Sinha wrote:
> > Yeah, I got. Thanks.
> >
> > It returns a json which have the stemmed words.I just need to parse it
> > and
> > get the value.
> >
> > But, isn't there any JAVA API available for it ?
> >
> > On Thu, Sep 3, 2015 at 7:58 PM, Upayavira  wrote:
> >
> > > yes, the URL should be something like:
> > >
> > >
> > >
> http://localhost:8983/solr/images/analysis/field?wt=json=true=
> > > =
> > >
> > > Upayavira
> > >
> > > On Thu, Sep 3, 2015, at 03:23 PM, Jack Krupansky wrote:
> > > > The # in the URL says to send the request to the admin UI, which of
> > > > course
> > > > returns an HTML web page. Instead, send the analysis URL fragment
> > > > directly
> > > > to the analysis API (not UI) for the Solr core, without the #.
> > > >
> > > > -- Jack Krupansky
> > > >
> > > > On Thu, Sep 3, 2015 at 8:45 AM, Ritesh Sinha <
> > > > kumarriteshranjansi...@gmail.com> wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > I observed the inspect element and wrote a code to give back the
> > > content. I
> > > > > have included the url which was getting generated.
> > > > >
> > > > > public class URLConnectionReader {
> > > > > public static void main(String[] args) throws Exception {
> > > > > URL solr = new URL(
> > > > > "
> > > > >
> > > > >
> > >
> http://localhost:8983/solr/#/testcore/analysis?analysis.fieldvalue=holidays=inferlytics_output=1
> > > > > ");
> > > > > URLConnection sl = solr.openConnection();
> > > > > BufferedReader in = new BufferedReader(new
> InputStreamReader(
> > > > > sl.getInputStream()));
> > > > > String inputLine;
> > > > >
> > > > > while ((inputLine = in.readLine()) != null)
> > > > > System.out.println(inputLine);
> > > > > in.close();
> > > > > }
> > > > > }
> > > > >
> > > > >
> > > > > But it shows this in the consloe :
> > > > >
> > > > >  > > > > http://www.w3.org/TR/html4/strict.dtd;>
> > > > > 
> > > > >
> > > > > 
> > > > >
> > > > > 
> > > > >
> > > > >   Solr Admin
> > > > >
> > > > >href="img/favicon.ico?_=5.3.0">
> > > > >> > > > href="img/favicon.ico?_=5.3.0">
> > > > >
> > > > >> > > > href="css/styles/common.css?_=5.3.0">
> > > > >> > > > href="css/styles/analysis.css?_=5.3.0">
> > > > >> > > > href="css/styles/cloud.css?_=5.3.0">
> > > > >> > > > href="css/styles/cores.css?_=5.3.0">
> > > > >> > > > href="css/styles/dashboard.css?_=5.3.0">
> > > > >> > > > href="css/styles/dataimport.css?_=5.3.0">
> > > > >> > > > href="css/styles/files.css?_=5.3.0">
> > > > >> > > > href="css/styles/index.css?_=5.3.0">
> > > > >> > > > href="css/styles/java-properties.css?_=5.3.0">
> > > > >> > > > href="css/styles/logging.css?_=5.3.0">
> > > > >> > > > href="css/styles/menu.css?_=5.3.0">
> > > > >> > > > 

Re: Stemming words Using Solr

2015-09-04 Thread Upayavira
I don't have a code snippet - I just found it in the solrj source code.

As to using JSON, I'm not sure of the structure of the JSON you are
getting back, but you might find adding json.nl=map, which changes the
way it returns named lists, which may be easier to parse.

Upayavira

On Fri, Sep 4, 2015, at 10:14 AM, Ritesh Sinha wrote:
> This is the code which i have written to get the stemmed word.
> 
> public class URLConnectionReader {
> public static void main(String[] args) throws Exception {
> URL solr = new URL(
> "http://localhost:8983/solr/
> "+args[0]+"/analysis/field?wt=json=true="+args[1]+"="+args[2]+"");
> URLConnection sl = solr.openConnection();
> BufferedReader in = new BufferedReader(new InputStreamReader(
> sl.getInputStream()));
> String inputLine;
> StringBuilder sb = new StringBuilder();
> while ((inputLine = in.readLine()) != null) {
> sb.append(inputLine);
> }
> 
> in.close();
> 
> JSONObject obj = new JSONObject(sb.toString());
> JSONArray analysis = obj.getJSONObject("analysis")
> .getJSONObject("field_types").getJSONObject(args[2])
> .getJSONArray("query");
> 
> JSONArray jsonarray = new JSONArray(analysis.toString());
> ArrayList stemmedWords = new ArrayList();
> for (int i = 0; i < jsonarray.length(); i++) {
> String objF = jsonarray.getString(i);
> stemmedWords.add(objF);
> }
> 
> String lastStemmedGroup = stemmedWords.get(stemmedWords.size() -
> 1).toString();
> 
> JSONArray finalStemmer = new JSONArray(lastStemmedGroup);
> 
> for (int i = 0; i < finalStemmer.length(); i++) {
> JSONObject jsonobject = finalStemmer.getJSONObject(i);
> String stemmedWord = jsonobject.getString("text");
> System.out.println(stemmedWord);
> }
> 
> }
> 
> }
> 
> 
> Here, args[0] is core.
> args[1] is the word i'll be sending for stemming.
> args[2] is the Analyse Fieldname / FieldType.
> 
> I am looking into FieldAnalysisRequest.
> Do you have some code snippet or something which can guide me ?
> 
> Thanks
> 
> On Fri, Sep 4, 2015 at 12:44 PM, Upayavira  wrote:
> 
> > Yes, look at the one I mentioned further up in this thread, which is a
> > part of SolrJ: FieldAnalysisRequest
> >
> > That uses the same HTTP call in the backend, but formats the result in a
> > Java friendly manner.
> >
> > Upayavira
> >
> > On Fri, Sep 4, 2015, at 05:52 AM, Ritesh Sinha wrote:
> > > Yeah, I got. Thanks.
> > >
> > > It returns a json which have the stemmed words.I just need to parse it
> > > and
> > > get the value.
> > >
> > > But, isn't there any JAVA API available for it ?
> > >
> > > On Thu, Sep 3, 2015 at 7:58 PM, Upayavira  wrote:
> > >
> > > > yes, the URL should be something like:
> > > >
> > > >
> > > >
> > http://localhost:8983/solr/images/analysis/field?wt=json=true=
> > > > =
> > > >
> > > > Upayavira
> > > >
> > > > On Thu, Sep 3, 2015, at 03:23 PM, Jack Krupansky wrote:
> > > > > The # in the URL says to send the request to the admin UI, which of
> > > > > course
> > > > > returns an HTML web page. Instead, send the analysis URL fragment
> > > > > directly
> > > > > to the analysis API (not UI) for the Solr core, without the #.
> > > > >
> > > > > -- Jack Krupansky
> > > > >
> > > > > On Thu, Sep 3, 2015 at 8:45 AM, Ritesh Sinha <
> > > > > kumarriteshranjansi...@gmail.com> wrote:
> > > > >
> > > > > > Hi,
> > > > > >
> > > > > > I observed the inspect element and wrote a code to give back the
> > > > content. I
> > > > > > have included the url which was getting generated.
> > > > > >
> > > > > > public class URLConnectionReader {
> > > > > > public static void main(String[] args) throws Exception {
> > > > > > URL solr = new URL(
> > > > > > "
> > > > > >
> > > > > >
> > > >
> > http://localhost:8983/solr/#/testcore/analysis?analysis.fieldvalue=holidays=inferlytics_output=1
> > > > > > ");
> > > > > > URLConnection sl = solr.openConnection();
> > > > > > BufferedReader in = new BufferedReader(new
> > InputStreamReader(
> > > > > > sl.getInputStream()));
> > > > > > String inputLine;
> > > > > >
> > > > > > while ((inputLine = in.readLine()) != null)
> > > > > > System.out.println(inputLine);
> > > > > > in.close();
> > > > > > }
> > > > > > }
> > > > > >
> > > > > >
> > > > > > But it shows this in the consloe :
> > > > > >
> > > > > >  > > > > > http://www.w3.org/TR/html4/strict.dtd;>
> > > > > > 
> > > > > >
> > > > > > 
> > > > > >
> > > > > > 
> > > > > >
> > > > > >   Solr Admin
> > > > > >
> > > > > >> href="img/favicon.ico?_=5.3.0">
> > > > > >> > > > > href="img/favicon.ico?_=5.3.0">
> > > > > >
> > > > > >> > > > > href="css/styles/common.css?_=5.3.0">
> > > > > >  

Re: Stemming words Using Solr

2015-09-04 Thread Ritesh Sinha
Adding json.nl=map instead of wt.json
 returns results in xml format.


   
  0
  2
   
   
  
 

   
   
   
   
   
   
   
   
   


   playing
   playing
   
  
 playing
 [70 6c 61 79 69 6e 67]
 0
 7
 1
 ALPHANUM
 1
 
1
 
  
   
   
  
 playing
 [70 6c 61 79 69 6e 67]
 0
 7
 1
 ALPHANUM
 1
 
1
1
 
  
   
   
  
 playing
 [70 6c 61 79 69 6e 67]
 0
 7
 1
 ALPHANUM
 false
 1
 
1
1
1
 
  
   
   
  
 playing
 [70 6c 61 79 69 6e 67]
 0
 7
 1
 ALPHANUM
 1
 
1
1
1
1
 
 false
  
   
   
  
 playing
 [70 6c 61 79 69 6e 67]
 0
 7
 1
 ALPHANUM
 1
 
1
1
1
1
1
 
 false
  
   
   
  
 playing
 [70 6c 61 79 69 6e 67]
 0
 7
 1
 ALPHANUM
 1
 
1
1
1
1
1
1
 
 false
  
   
   
  
 plai
 [70 6c 61 69]
 0
 7
 1
 ALPHANUM
 false
 1
 
1
1
1
1
1
1
1
 
  
   

 
  
  
   



On Fri, Sep 4, 2015 at 2:51 PM, Upayavira  wrote:

> I don't have a code snippet - I just found it in the solrj source code.
>
> As to using JSON, I'm not sure of the structure of the JSON you are
> getting back, but you might find adding json.nl=map, which changes the
> way it returns named lists, which may be easier to parse.
>
> Upayavira
>
> On Fri, Sep 4, 2015, at 10:14 AM, Ritesh Sinha wrote:
> > This is the code which i have written to get the stemmed word.
> >
> > public class URLConnectionReader {
> > public static void main(String[] args) throws Exception {
> > URL solr = new URL(
> > "http://localhost:8983/solr/
> >
> "+args[0]+"/analysis/field?wt=json=true="+args[1]+"="+args[2]+"");
> > URLConnection sl = solr.openConnection();
> > BufferedReader in = new BufferedReader(new InputStreamReader(
> > sl.getInputStream()));
> > String inputLine;
> > StringBuilder sb = new StringBuilder();
> > while ((inputLine = in.readLine()) != null) {
> > sb.append(inputLine);
> > }
> >
> > in.close();
> >
> > JSONObject obj = new JSONObject(sb.toString());
> > JSONArray analysis = obj.getJSONObject("analysis")
> > .getJSONObject("field_types").getJSONObject(args[2])
> > .getJSONArray("query");
> >
> > JSONArray jsonarray = new JSONArray(analysis.toString());
> > ArrayList stemmedWords = new ArrayList();
> > for (int i = 0; i < jsonarray.length(); i++) {
> > String 

Re: Stemming words Using Solr

2015-09-04 Thread Upayavira
Yes, look at the one I mentioned further up in this thread, which is a
part of SolrJ: FieldAnalysisRequest

That uses the same HTTP call in the backend, but formats the result in a
Java friendly manner.

Upayavira

On Fri, Sep 4, 2015, at 05:52 AM, Ritesh Sinha wrote:
> Yeah, I got. Thanks.
> 
> It returns a json which have the stemmed words.I just need to parse it
> and
> get the value.
> 
> But, isn't there any JAVA API available for it ?
> 
> On Thu, Sep 3, 2015 at 7:58 PM, Upayavira  wrote:
> 
> > yes, the URL should be something like:
> >
> >
> > http://localhost:8983/solr/images/analysis/field?wt=json=true=
> > =
> >
> > Upayavira
> >
> > On Thu, Sep 3, 2015, at 03:23 PM, Jack Krupansky wrote:
> > > The # in the URL says to send the request to the admin UI, which of
> > > course
> > > returns an HTML web page. Instead, send the analysis URL fragment
> > > directly
> > > to the analysis API (not UI) for the Solr core, without the #.
> > >
> > > -- Jack Krupansky
> > >
> > > On Thu, Sep 3, 2015 at 8:45 AM, Ritesh Sinha <
> > > kumarriteshranjansi...@gmail.com> wrote:
> > >
> > > > Hi,
> > > >
> > > > I observed the inspect element and wrote a code to give back the
> > content. I
> > > > have included the url which was getting generated.
> > > >
> > > > public class URLConnectionReader {
> > > > public static void main(String[] args) throws Exception {
> > > > URL solr = new URL(
> > > > "
> > > >
> > > >
> > http://localhost:8983/solr/#/testcore/analysis?analysis.fieldvalue=holidays=inferlytics_output=1
> > > > ");
> > > > URLConnection sl = solr.openConnection();
> > > > BufferedReader in = new BufferedReader(new InputStreamReader(
> > > > sl.getInputStream()));
> > > > String inputLine;
> > > >
> > > > while ((inputLine = in.readLine()) != null)
> > > > System.out.println(inputLine);
> > > > in.close();
> > > > }
> > > > }
> > > >
> > > >
> > > > But it shows this in the consloe :
> > > >
> > > >  > > > http://www.w3.org/TR/html4/strict.dtd;>
> > > > 
> > > >
> > > > 
> > > >
> > > > 
> > > >
> > > >   Solr Admin
> > > >
> > > >   
> > > >> > > href="img/favicon.ico?_=5.3.0">
> > > >
> > > >> > > href="css/styles/common.css?_=5.3.0">
> > > >> > > href="css/styles/analysis.css?_=5.3.0">
> > > >> > > href="css/styles/cloud.css?_=5.3.0">
> > > >> > > href="css/styles/cores.css?_=5.3.0">
> > > >> > > href="css/styles/dashboard.css?_=5.3.0">
> > > >> > > href="css/styles/dataimport.css?_=5.3.0">
> > > >> > > href="css/styles/files.css?_=5.3.0">
> > > >> > > href="css/styles/index.css?_=5.3.0">
> > > >> > > href="css/styles/java-properties.css?_=5.3.0">
> > > >> > > href="css/styles/logging.css?_=5.3.0">
> > > >> > > href="css/styles/menu.css?_=5.3.0">
> > > >> > > href="css/styles/plugins.css?_=5.3.0">
> > > >> > > href="css/styles/documents.css?_=5.3.0">
> > > >> > > href="css/styles/query.css?_=5.3.0">
> > > >> > > href="css/styles/replication.css?_=5.3.0">
> > > >> > > href="css/styles/schema-browser.css?_=5.3.0">
> > > >> > > href="css/styles/threads.css?_=5.3.0">
> > > >> > > href="css/styles/segments.css?_=5.3.0">
> > > >   
> > > >
> > > >   
> > > >
> > > >   
> > > >
> > > >   var app_config = {};
> > > >
> > > >   app_config.solr_path = '\/solr';
> > > >   app_config.core_admin_path = '\/admin\/cores';
> > > >
> > > >   
> > > >
> > > > 
> > > > 
> > > >
> > > >   
> > > >
> > > > 
> > > >
> > > >   Apache SOLR
> > > >
> > > >   
> > > >
> > > > 
> > > >
> > > > 
> > > >
> > > >   
> > > >
> > > >   SolrCore Initialization Failures
> > > >   
> > > >   Please check your logs for more information
> > > >
> > > >   
> > > >
> > > >   
> > > > 
> > > >
> > > >   
> > > >
> > > > 
> > > >   
> > > >
> > > >   
> > > > 
> > > >
> > > >   
> > > >
> > > >  > > > href="#/">Dashboard
> > > >
> > > >  > > > href="#/~logging">Logging
> > > >   
> > > >  > href="#/~logging/level">Level
> > > >   
> > > > 
> > > >
> > > >  > > > href="#/~cloud">Cloud
> > > >   
> > > >  > href="#/~cloud?view=tree">Tree
> > > > Graph
> > > > Graph
> > > > (Radial)
> > > > Dump
> > > >   
> > > > 
> > > >
> > > > Core
> > > > Admin
> > > >
> > > >  > > > href="#/~java-properties">Java Properties
> > > >
> > > >  > href="#/~threads">Thread
> > > > Dump
> > > >
> > > >   
> > > >
> > > >   
> > > > 
> > > >   
> > > > 
> > > > 
> > > >   No cores available
> > > >   Go and create one
> > > > 
> > > >   
> > > 

Re: Stemming words Using Solr

2015-09-03 Thread Jack Krupansky
The # in the URL says to send the request to the admin UI, which of course
returns an HTML web page. Instead, send the analysis URL fragment directly
to the analysis API (not UI) for the Solr core, without the #.

-- Jack Krupansky

On Thu, Sep 3, 2015 at 8:45 AM, Ritesh Sinha <
kumarriteshranjansi...@gmail.com> wrote:

> Hi,
>
> I observed the inspect element and wrote a code to give back the content. I
> have included the url which was getting generated.
>
> public class URLConnectionReader {
> public static void main(String[] args) throws Exception {
> URL solr = new URL(
> "
>
> http://localhost:8983/solr/#/testcore/analysis?analysis.fieldvalue=holidays=inferlytics_output=1
> ");
> URLConnection sl = solr.openConnection();
> BufferedReader in = new BufferedReader(new InputStreamReader(
> sl.getInputStream()));
> String inputLine;
>
> while ((inputLine = in.readLine()) != null)
> System.out.println(inputLine);
> in.close();
> }
> }
>
>
> But it shows this in the consloe :
>
>  http://www.w3.org/TR/html4/strict.dtd;>
> 
>
> 
>
> 
>
>   Solr Admin
>
>   
>href="img/favicon.ico?_=5.3.0">
>
>href="css/styles/common.css?_=5.3.0">
>href="css/styles/analysis.css?_=5.3.0">
>href="css/styles/cloud.css?_=5.3.0">
>href="css/styles/cores.css?_=5.3.0">
>href="css/styles/dashboard.css?_=5.3.0">
>href="css/styles/dataimport.css?_=5.3.0">
>href="css/styles/files.css?_=5.3.0">
>href="css/styles/index.css?_=5.3.0">
>href="css/styles/java-properties.css?_=5.3.0">
>href="css/styles/logging.css?_=5.3.0">
>href="css/styles/menu.css?_=5.3.0">
>href="css/styles/plugins.css?_=5.3.0">
>href="css/styles/documents.css?_=5.3.0">
>href="css/styles/query.css?_=5.3.0">
>href="css/styles/replication.css?_=5.3.0">
>href="css/styles/schema-browser.css?_=5.3.0">
>href="css/styles/threads.css?_=5.3.0">
>href="css/styles/segments.css?_=5.3.0">
>   
>
>   
>
>   
>
>   var app_config = {};
>
>   app_config.solr_path = '\/solr';
>   app_config.core_admin_path = '\/admin\/cores';
>
>   
>
> 
> 
>
>   
>
> 
>
>   Apache SOLR
>
>   
>
> 
>
> 
>
>   
>
>   SolrCore Initialization Failures
>   
>   Please check your logs for more information
>
>   
>
>   
> 
>
>   
>
> 
>   
>
>   
> 
>
>   
>
>  href="#/">Dashboard
>
>  href="#/~logging">Logging
>   
> Level
>   
> 
>
>  href="#/~cloud">Cloud
>   
> Tree
> Graph
> Graph
> (Radial)
> Dump
>   
> 
>
> Core
> Admin
>
>  href="#/~java-properties">Java Properties
>
> Thread
> Dump
>
>   
>
>   
> 
>   
> 
> 
>   No cores available
>   Go and create one
> 
>   
>   
> 
>   
>
> 
>   
>
>   
>
> 
>
>   http://lucene.apache.org/solr/
> ">Documentation
>   http://issues.apache.org/jira/browse/SOLR;>Issue
> Tracker
>href="https://wiki.apache.org/solr/IRCChannels;>IRC
> Channel
>   http://lucene.apache.org/solr/resources.html#community;>Community
> forum
>   https://cwiki.apache.org/confluence/display/solr/Query+Syntax+and+Parsing
> ">Solr
> Query Syntax
>
> 
>
>   
>
> 
>
>   
>
>   
>
> Connection lost 
>
>   
>
>var require = { urlArgs: '_=5.3.0' };
> 
>   
>
> 
> 
>
>
> On Thu, Sep 3, 2015 at 4:12 PM, Upayavira  wrote:
>
> >
> >
> > On Thu, Sep 3, 2015, at 11:19 AM, Ritesh Sinha wrote:
> > > I am learning solr and want to use solr for stemming words.I'll be
> > > passing
> > > the word to the solr and it should send the stemmed word back.I know
> how
> > > to
> > > configure solr core for different stemming patterns and also i am able
> to
> > > view their stemmed words in the analyzer (solr admin ui) but i am not
> > > sure
> > > how to achieve this using java code.I am able to index and query using
> > > java
> > > api.
> >
> > Use your browser's "developer tools" to see what is going on behind the
> > scenes when you use the admin UI analysis tab.
> >
> > It is just an HTTP call that you can replicate from Java. I see that
> > SolrJ has a FieldAnalysisRequest that I suspect does the very same
> > thing.
> >
> > Hope that helps.
> >
> > Upayavira
> >
>


Re: Stemming words Using Solr

2015-09-03 Thread Upayavira
yes, the URL should be something like:

http://localhost:8983/solr/images/analysis/field?wt=json=true==

Upayavira

On Thu, Sep 3, 2015, at 03:23 PM, Jack Krupansky wrote:
> The # in the URL says to send the request to the admin UI, which of
> course
> returns an HTML web page. Instead, send the analysis URL fragment
> directly
> to the analysis API (not UI) for the Solr core, without the #.
> 
> -- Jack Krupansky
> 
> On Thu, Sep 3, 2015 at 8:45 AM, Ritesh Sinha <
> kumarriteshranjansi...@gmail.com> wrote:
> 
> > Hi,
> >
> > I observed the inspect element and wrote a code to give back the content. I
> > have included the url which was getting generated.
> >
> > public class URLConnectionReader {
> > public static void main(String[] args) throws Exception {
> > URL solr = new URL(
> > "
> >
> > http://localhost:8983/solr/#/testcore/analysis?analysis.fieldvalue=holidays=inferlytics_output=1
> > ");
> > URLConnection sl = solr.openConnection();
> > BufferedReader in = new BufferedReader(new InputStreamReader(
> > sl.getInputStream()));
> > String inputLine;
> >
> > while ((inputLine = in.readLine()) != null)
> > System.out.println(inputLine);
> > in.close();
> > }
> > }
> >
> >
> > But it shows this in the consloe :
> >
> >  > http://www.w3.org/TR/html4/strict.dtd;>
> > 
> >
> > 
> >
> > 
> >
> >   Solr Admin
> >
> >   
> >> href="img/favicon.ico?_=5.3.0">
> >
> >> href="css/styles/common.css?_=5.3.0">
> >> href="css/styles/analysis.css?_=5.3.0">
> >> href="css/styles/cloud.css?_=5.3.0">
> >> href="css/styles/cores.css?_=5.3.0">
> >> href="css/styles/dashboard.css?_=5.3.0">
> >> href="css/styles/dataimport.css?_=5.3.0">
> >> href="css/styles/files.css?_=5.3.0">
> >> href="css/styles/index.css?_=5.3.0">
> >> href="css/styles/java-properties.css?_=5.3.0">
> >> href="css/styles/logging.css?_=5.3.0">
> >> href="css/styles/menu.css?_=5.3.0">
> >> href="css/styles/plugins.css?_=5.3.0">
> >> href="css/styles/documents.css?_=5.3.0">
> >> href="css/styles/query.css?_=5.3.0">
> >> href="css/styles/replication.css?_=5.3.0">
> >> href="css/styles/schema-browser.css?_=5.3.0">
> >> href="css/styles/threads.css?_=5.3.0">
> >> href="css/styles/segments.css?_=5.3.0">
> >   
> >
> >   
> >
> >   
> >
> >   var app_config = {};
> >
> >   app_config.solr_path = '\/solr';
> >   app_config.core_admin_path = '\/admin\/cores';
> >
> >   
> >
> > 
> > 
> >
> >   
> >
> > 
> >
> >   Apache SOLR
> >
> >   
> >
> > 
> >
> > 
> >
> >   
> >
> >   SolrCore Initialization Failures
> >   
> >   Please check your logs for more information
> >
> >   
> >
> >   
> > 
> >
> >   
> >
> > 
> >   
> >
> >   
> > 
> >
> >   
> >
> >  > href="#/">Dashboard
> >
> >  > href="#/~logging">Logging
> >   
> > Level
> >   
> > 
> >
> >  > href="#/~cloud">Cloud
> >   
> > Tree
> > Graph
> > Graph
> > (Radial)
> > Dump
> >   
> > 
> >
> > Core
> > Admin
> >
> >  > href="#/~java-properties">Java Properties
> >
> > Thread
> > Dump
> >
> >   
> >
> >   
> > 
> >   
> > 
> > 
> >   No cores available
> >   Go and create one
> > 
> >   
> >   
> > 
> >   
> >
> > 
> >   
> >
> >   
> >
> > 
> >
> >   http://lucene.apache.org/solr/
> > ">Documentation
> >   http://issues.apache.org/jira/browse/SOLR;>Issue
> > Tracker
> >> href="https://wiki.apache.org/solr/IRCChannels;>IRC
> > Channel
> >   http://lucene.apache.org/solr/resources.html#community;>Community
> > forum
> >   https://cwiki.apache.org/confluence/display/solr/Query+Syntax+and+Parsing
> > ">Solr
> > Query Syntax
> >
> > 
> >
> >   
> >
> > 
> >
> >   
> >
> >   
> >
> > Connection lost 
> >
> >   
> >
> >var require = { urlArgs: '_=5.3.0' };
> > 
> >   
> >
> > 
> > 
> >
> >
> > On Thu, Sep 3, 2015 at 4:12 PM, Upayavira  wrote:
> >
> > >
> > >
> > > On Thu, Sep 3, 2015, at 11:19 AM, Ritesh Sinha wrote:
> > > > I am learning solr and want to use solr for stemming words.I'll be
> > > > passing
> > > > the word to the solr and it should send the stemmed word back.I know
> > how
> > > > to
> > > > configure solr core for different stemming patterns and also i am able
> > to
> > > > view their stemmed words in the analyzer (solr admin ui) but i am not
> > > > sure
> > > > how to achieve this using java code.I am able to index and query using
> > > > java
> > > > api.
> > >

Re: Stemming words Using Solr

2015-09-03 Thread Upayavira


On Thu, Sep 3, 2015, at 11:19 AM, Ritesh Sinha wrote:
> I am learning solr and want to use solr for stemming words.I'll be
> passing
> the word to the solr and it should send the stemmed word back.I know how
> to
> configure solr core for different stemming patterns and also i am able to
> view their stemmed words in the analyzer (solr admin ui) but i am not
> sure
> how to achieve this using java code.I am able to index and query using
> java
> api.

Use your browser's "developer tools" to see what is going on behind the
scenes when you use the admin UI analysis tab.

It is just an HTTP call that you can replicate from Java. I see that
SolrJ has a FieldAnalysisRequest that I suspect does the very same
thing.

Hope that helps.

Upayavira


Stemming words Using Solr

2015-09-03 Thread Ritesh Sinha
I am learning solr and want to use solr for stemming words.I'll be passing
the word to the solr and it should send the stemmed word back.I know how to
configure solr core for different stemming patterns and also i am able to
view their stemmed words in the analyzer (solr admin ui) but i am not sure
how to achieve this using java code.I am able to index and query using java
api.

I am using solr-5.3.0.


Re: Stemming words Using Solr

2015-09-03 Thread Ritesh Sinha
Yeah, I got. Thanks.

It returns a json which have the stemmed words.I just need to parse it and
get the value.

But, isn't there any JAVA API available for it ?

On Thu, Sep 3, 2015 at 7:58 PM, Upayavira  wrote:

> yes, the URL should be something like:
>
>
> http://localhost:8983/solr/images/analysis/field?wt=json=true=
> =
>
> Upayavira
>
> On Thu, Sep 3, 2015, at 03:23 PM, Jack Krupansky wrote:
> > The # in the URL says to send the request to the admin UI, which of
> > course
> > returns an HTML web page. Instead, send the analysis URL fragment
> > directly
> > to the analysis API (not UI) for the Solr core, without the #.
> >
> > -- Jack Krupansky
> >
> > On Thu, Sep 3, 2015 at 8:45 AM, Ritesh Sinha <
> > kumarriteshranjansi...@gmail.com> wrote:
> >
> > > Hi,
> > >
> > > I observed the inspect element and wrote a code to give back the
> content. I
> > > have included the url which was getting generated.
> > >
> > > public class URLConnectionReader {
> > > public static void main(String[] args) throws Exception {
> > > URL solr = new URL(
> > > "
> > >
> > >
> http://localhost:8983/solr/#/testcore/analysis?analysis.fieldvalue=holidays=inferlytics_output=1
> > > ");
> > > URLConnection sl = solr.openConnection();
> > > BufferedReader in = new BufferedReader(new InputStreamReader(
> > > sl.getInputStream()));
> > > String inputLine;
> > >
> > > while ((inputLine = in.readLine()) != null)
> > > System.out.println(inputLine);
> > > in.close();
> > > }
> > > }
> > >
> > >
> > > But it shows this in the consloe :
> > >
> > >  > > http://www.w3.org/TR/html4/strict.dtd;>
> > > 
> > >
> > > 
> > >
> > > 
> > >
> > >   Solr Admin
> > >
> > >   
> > >> > href="img/favicon.ico?_=5.3.0">
> > >
> > >> > href="css/styles/common.css?_=5.3.0">
> > >> > href="css/styles/analysis.css?_=5.3.0">
> > >> > href="css/styles/cloud.css?_=5.3.0">
> > >> > href="css/styles/cores.css?_=5.3.0">
> > >> > href="css/styles/dashboard.css?_=5.3.0">
> > >> > href="css/styles/dataimport.css?_=5.3.0">
> > >> > href="css/styles/files.css?_=5.3.0">
> > >> > href="css/styles/index.css?_=5.3.0">
> > >> > href="css/styles/java-properties.css?_=5.3.0">
> > >> > href="css/styles/logging.css?_=5.3.0">
> > >> > href="css/styles/menu.css?_=5.3.0">
> > >> > href="css/styles/plugins.css?_=5.3.0">
> > >> > href="css/styles/documents.css?_=5.3.0">
> > >> > href="css/styles/query.css?_=5.3.0">
> > >> > href="css/styles/replication.css?_=5.3.0">
> > >> > href="css/styles/schema-browser.css?_=5.3.0">
> > >> > href="css/styles/threads.css?_=5.3.0">
> > >> > href="css/styles/segments.css?_=5.3.0">
> > >   
> > >
> > >   
> > >
> > >   
> > >
> > >   var app_config = {};
> > >
> > >   app_config.solr_path = '\/solr';
> > >   app_config.core_admin_path = '\/admin\/cores';
> > >
> > >   
> > >
> > > 
> > > 
> > >
> > >   
> > >
> > > 
> > >
> > >   Apache SOLR
> > >
> > >   
> > >
> > > 
> > >
> > > 
> > >
> > >   
> > >
> > >   SolrCore Initialization Failures
> > >   
> > >   Please check your logs for more information
> > >
> > >   
> > >
> > >   
> > > 
> > >
> > >   
> > >
> > > 
> > >   
> > >
> > >   
> > > 
> > >
> > >   
> > >
> > >  > > href="#/">Dashboard
> > >
> > >  > > href="#/~logging">Logging
> > >   
> > >  href="#/~logging/level">Level
> > >   
> > > 
> > >
> > >  > > href="#/~cloud">Cloud
> > >   
> > >  href="#/~cloud?view=tree">Tree
> > > Graph
> > > Graph
> > > (Radial)
> > > Dump
> > >   
> > > 
> > >
> > > Core
> > > Admin
> > >
> > >  > > href="#/~java-properties">Java Properties
> > >
> > >  href="#/~threads">Thread
> > > Dump
> > >
> > >   
> > >
> > >   
> > > 
> > >   
> > > 
> > > 
> > >   No cores available
> > >   Go and create one
> > > 
> > >   
> > >   
> > > 
> > >   
> > >
> > > 
> > >   
> > >
> > >   
> > >
> > > 
> > >
> > >   http://lucene.apache.org/solr/
> > > ">Documentation
> > >   http://issues.apache.org/jira/browse/SOLR;>Issue
> > > Tracker
> > >> > href="https://wiki.apache.org/solr/IRCChannels;>IRC
> > > Channel
> > >   http://lucene.apache.org/solr/resources.html#community
> ">Community
> > > forum
> > >   https://cwiki.apache.org/confluence/display/solr/Query+Syntax+and+Parsing
> > > ">Solr
> > > Query Syntax
> > >
> > > 
> > >
> > >   
> > >
> > > 
> > >
> > >   
> > >
> > >   
> 

Re: Stemming words Using Solr

2015-09-03 Thread Ritesh Sinha
Hi,

I observed the inspect element and wrote a code to give back the content. I
have included the url which was getting generated.

public class URLConnectionReader {
public static void main(String[] args) throws Exception {
URL solr = new URL(
"
http://localhost:8983/solr/#/testcore/analysis?analysis.fieldvalue=holidays=inferlytics_output=1
");
URLConnection sl = solr.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(
sl.getInputStream()));
String inputLine;

while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
}
}


But it shows this in the consloe :

http://www.w3.org/TR/html4/strict.dtd;>






  Solr Admin

  
  

  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  

  

  

  var app_config = {};

  app_config.solr_path = '\/solr';
  app_config.core_admin_path = '\/admin\/cores';

  




  



  Apache SOLR

  





  

  SolrCore Initialization Failures
  
  Please check your logs for more information

  

  


  


  

  


  

Dashboard

Logging
  
Level
  


Cloud
  
Tree
Graph
Graph
(Radial)
Dump
  


Core
Admin

Java Properties

Thread
Dump

  

  

  


  No cores available
  Go and create one

  
  

  


  

  



  http://lucene.apache.org/solr/
">Documentation
  http://issues.apache.org/jira/browse/SOLR;>Issue
Tracker
  https://wiki.apache.org/solr/IRCChannels;>IRC
Channel
  http://lucene.apache.org/solr/resources.html#community;>Community
forum
  https://cwiki.apache.org/confluence/display/solr/Query+Syntax+and+Parsing;>Solr
Query Syntax



  



  

  

Connection lost 

  

   var require = { urlArgs: '_=5.3.0' };

  





On Thu, Sep 3, 2015 at 4:12 PM, Upayavira  wrote:

>
>
> On Thu, Sep 3, 2015, at 11:19 AM, Ritesh Sinha wrote:
> > I am learning solr and want to use solr for stemming words.I'll be
> > passing
> > the word to the solr and it should send the stemmed word back.I know how
> > to
> > configure solr core for different stemming patterns and also i am able to
> > view their stemmed words in the analyzer (solr admin ui) but i am not
> > sure
> > how to achieve this using java code.I am able to index and query using
> > java
> > api.
>
> Use your browser's "developer tools" to see what is going on behind the
> scenes when you use the admin UI analysis tab.
>
> It is just an HTTP call that you can replicate from Java. I see that
> SolrJ has a FieldAnalysisRequest that I suspect does the very same
> thing.
>
> Hope that helps.
>
> Upayavira
>