org.apache.*.*.... class not found exception in Internet Explorer
Hi, I'm trying to query solr indexer thru a web page and trying to display the result. I've the following class to query solr [I'm using the query(string) method], import org.apache.solr.common.SolrDocumentList; import org.apache.solr.common.SolrDocument; import java.util.Map; import java.util.Iterator; import java.util.List; import java.util.ArrayList; import java.util.HashMap; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.response.QueryResponse; import org.apache.solr.client.solrj.response.FacetField; import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer; public class SolrjTest { public String query(String q) { CommonsHttpSolrServer server = null; try { server = new CommonsHttpSolrServer(http://localhost:8983/solr/ ); } catch(Exception e) { e.printStackTrace(); } SolrQuery query = new SolrQuery(); query.setQuery(q); query.setQueryType(dismax); query.setIncludeScore(true); try { QueryResponse qr = server.query(query); SolrDocumentList sdl = qr.getResults(); //System.out.println(Found: + sdl.getNumFound()); //System.out.println(Start: + sdl.getStart()); //System.out.println(Max Score: + sdl.getMaxScore()); //System.out.println(); //System.out.println(Result doc : + sdl); return sdl.toString(); } catch (SolrServerException e) { e.printStackTrace(); return null; } } } and the following to pass the queries to solr, get results and display it on the browser, import java.applet.Applet; import java.awt.Graphics; import java.awt.Font; public class ControlJava extends Applet { Font f = new Font(TimesRoman, Font.BOLD, 20); String Message; public void init() { Message = new String(ubuntu); } public void SetMessage(String MsgText) { SolrjTest solr = new SolrjTest(); Message = solr.query(MsgText); repaint(); } public void paint(Graphics g) { g.setFont(f); g.drawString(Message, 15, 50); } } and finally the html page is this, HTML HEAD TITLEControl a Java Applet/TITLE /HEAD BODY H1Control a Java Applet/H1 HR The Java applet below displays text in a large font. You can enter new text to display in the form below, and JavaScript will call the Java applet to change the text. HR FORM NAME=form1 INPUT TYPE=TEXT NAME=text1 INPUT TYPE=BUTTON VALUE=Change Text onClick=document.ControlJava.SetMessage(document.form1.text1.value); /FORM HR APPLET NAME=ControlJava CODE=ControlJava.class WIDTH=450 HEIGHT=125 /APPLET HR End of page. /BODY /HTML When I'm trying to access this page and putting the query in the box that this html shows, the browser [IE] gives some error and after checking I found that the error is some class not found exception, its not able to find the org.apache.*.* classes and hence giving errors. Now instead of calling that I wrote a simpe class not using any apache.solr classes and called the method therein [just returns a string] and it worked fine. I added both both the classes [.class files] given above to the same location where this web page resides. The problem is that browser is not able to find those org.apache.*** classes and creating the mess. Can anyone help this newbie fixing the problem. Thanks a lot. Do let me know if some information is missing/want some extra information on this issue. --Ahmed.
Re: org.apache.*.*.... class not found exception in Internet Explorer
Missed some information. I'm working on Windows XP and my class path is this, .;E:\Program Files\Java\jdk1.6.0_05\bin;D:\firefox download\apache-solr-1.3.0\apache-solr-1.3.0\dist\solrj-lib\commons-httpclient-3.1.jar;D:\firefox download\apache-solr-1.3.0\apache-solr-1.3.0\dist\solrj-lib\apache-solr-common.jar;D:\firefox download\apache-solr-1.3.0\apache-solr-1.3.0\dist\solrj-lib\apache-solr-1.3.0.jar;D:\firefox download\apache-solr-1.3.0\apache-solr-1.3.0\dist\solrj-lib\solr-solrj-1.3.0.jar;D:\firefox download\apache-solr-1.3.0\apache-solr-1.3.0\dist\solrj-lib\commons-io-1.3.1.jar;D:\firefox download\apache-solr-1.3.0\apache-solr-1.3.0\dist\solrj-lib\commons-codec-1.3.jar;D:\firefox download\apache-solr-1.3.0\apache-solr-1.3.0\dist\solrj-lib\commons-logging-1.0.4.jar Thanks, Ahmed. On Mon, May 4, 2009 at 12:10 PM, ahmed baseet ahmed.bas...@gmail.comwrote: Hi, I'm trying to query solr indexer thru a web page and trying to display the result. I've the following class to query solr [I'm using the query(string) method], import org.apache.solr.common.SolrDocumentList; import org.apache.solr.common.SolrDocument; import java.util.Map; import java.util.Iterator; import java.util.List; import java.util.ArrayList; import java.util.HashMap; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.response.QueryResponse; import org.apache.solr.client.solrj.response.FacetField; import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer; public class SolrjTest { public String query(String q) { CommonsHttpSolrServer server = null; try { server = new CommonsHttpSolrServer( http://localhost:8983/solr/;); } catch(Exception e) { e.printStackTrace(); } SolrQuery query = new SolrQuery(); query.setQuery(q); query.setQueryType(dismax); query.setIncludeScore(true); try { QueryResponse qr = server.query(query); SolrDocumentList sdl = qr.getResults(); //System.out.println(Found: + sdl.getNumFound()); //System.out.println(Start: + sdl.getStart()); //System.out.println(Max Score: + sdl.getMaxScore()); //System.out.println(); //System.out.println(Result doc : + sdl); return sdl.toString(); } catch (SolrServerException e) { e.printStackTrace(); return null; } } } and the following to pass the queries to solr, get results and display it on the browser, import java.applet.Applet; import java.awt.Graphics; import java.awt.Font; public class ControlJava extends Applet { Font f = new Font(TimesRoman, Font.BOLD, 20); String Message; public void init() { Message = new String(ubuntu); } public void SetMessage(String MsgText) { SolrjTest solr = new SolrjTest(); Message = solr.query(MsgText); repaint(); } public void paint(Graphics g) { g.setFont(f); g.drawString(Message, 15, 50); } } and finally the html page is this, HTML HEAD TITLEControl a Java Applet/TITLE /HEAD BODY H1Control a Java Applet/H1 HR The Java applet below displays text in a large font. You can enter new text to display in the form below, and JavaScript will call the Java applet to change the text. HR FORM NAME=form1 INPUT TYPE=TEXT NAME=text1 INPUT TYPE=BUTTON VALUE=Change Text onClick=document.ControlJava.SetMessage(document.form1.text1.value); /FORM HR APPLET NAME=ControlJava CODE=ControlJava.class WIDTH=450 HEIGHT=125 /APPLET HR End of page. /BODY /HTML When I'm trying to access this page and putting the query in the box that this html shows, the browser [IE] gives some error and after checking I found that the error is some class not found exception, its not able to find the org.apache.*.* classes and hence giving errors. Now instead of calling that I wrote a simpe class not using any apache.solr classes and called the method therein [just returns a string] and it worked fine. I added both both the classes [.class files] given above to the same location where this web page resides. The problem is that browser is not able to find those org.apache.*** classes and creating the mess. Can anyone help this newbie fixing the problem. Thanks a lot. Do let me know if some information is missing/want some extra information on this issue. --Ahmed.
Re: Update an existing Solr Index
As I know when you resend another index request with some old ID, old field but new content, the old one gets overwritten by the new one. @solr-users, Views??? --Ahmed On Mon, May 4, 2009 at 5:26 PM, appleman1982 prasad.jug...@gmail.comwrote: Hi All, I have a requirement wherein i want to update an existing index in solr. For example : I have issued an index command in solr as add doc field name=id123/field field name=namexxx/field /doc /add The id field is a unique key here. My requirement is that i should be able to update this inex i.e add another field to it without the need to build the entire index again. For example if i issue the following solr command add doc field name=id123/field field name=locationdelhi/field /doc /add it should give me a merged index like add doc field name=id123/field field name=namexxx/field field name=locationdelhi/field /doc /add Any pointers or workarounds to achieve this in solr would be highly appreciated. Thanks, Jugesh -- View this message in context: http://www.nabble.com/Update-an-existing-Solr-Index-tp23366705p23366705.html Sent from the Solr - User mailing list archive at Nabble.com.
How to iterate the solrdocumentlist result
Hi All, I'm able to get the whole result bundle by using the following method, QueryResponse qr = server.query(query); SolrDocumentList sdl = qr.getResults(); but I'm not able to iterate over the results. I converted this to string and displayed that and that is a full result bundle, I think its in XML. Actually I want to display the result in a browser and each one separately, I mean not as a bundle. There must be some standard methods for this, right ? Can some one give me some pointers in this regard... I'm trying to integrate the java method calls withing html code itself[ the solr server is on my box, and I want to do the testing on my box, so I want to access the indexer from my local box's browser only]. Any good ideas on this? Thanks, Ahmed.
Addition of new field to Solr schema.xml not getting reflected properly
Hi All, I'm trying to add a new field to Solr, so I stopped the tomcat[I'm working on Windows] using the Configure Tomcat menu of Tomcat, then added the following field field name=pageContent type=string indexed=true stored=true/ After restarting Tomcat, I couldn't see the changes, so I did the restart couple of times, and then the schema showed me the changes. Now I tried to change the type to text from the current string. I did that and restarted tomcat many times but the changes are still not getting reflected. I've used Solr1.2 earlier on linux, and every time I just had to touch the web.xml in webapp directory thereby forcing tomcat to restart itself for changes in schema.xml to take effect, but in windows I'm not able to figure out whats the issue. Is there anything wrong, I'm I supposed to restart tomcat in some other way instead of using the Configure tomcat menu. Has anyone faced similar issues with solr1.3 on windows? Any suggestion would be appreciated. Thanks, Ahmed.
Re: Addition of new field to Solr schema.xml not getting reflected properly
I added some new documents, and for these docs I can use the new field, right? Though to reflect the changes for all docs I need to delete the old index and build a new one. As I mentioned earlier after a couple of restarts its worked. Still don't know whats the issue. :-) Thanks, Ahmed. On Wed, Apr 29, 2009 at 4:13 PM, Erik Hatcher e...@ehatchersolutions.comwrote: Did you reindex your documents after making changes and restarting? The types of changes you're making require reindexing. Erik On Apr 29, 2009, at 2:13 AM, ahmed baseet wrote: Hi All, I'm trying to add a new field to Solr, so I stopped the tomcat[I'm working on Windows] using the Configure Tomcat menu of Tomcat, then added the following field field name=pageContent type=string indexed=true stored=true/ After restarting Tomcat, I couldn't see the changes, so I did the restart couple of times, and then the schema showed me the changes. Now I tried to change the type to text from the current string. I did that and restarted tomcat many times but the changes are still not getting reflected. I've used Solr1.2 earlier on linux, and every time I just had to touch the web.xml in webapp directory thereby forcing tomcat to restart itself for changes in schema.xml to take effect, but in windows I'm not able to figure out whats the issue. Is there anything wrong, I'm I supposed to restart tomcat in some other way instead of using the Configure tomcat menu. Has anyone faced similar issues with solr1.3 on windows? Any suggestion would be appreciated. Thanks, Ahmed.
Problem adding unicoded docs to Solr through SolrJ
Hi All, I'm trying to automate the process of posting xml s to Solr using Solrj. Essentially I'm extracting the text from a given Url, then creating a solrDoc and posting the same using the following function, public void postToSolrUsingSolrj(String rawText, String pageId) { String url = http://localhost:8983/solr;; CommonsHttpSolrServer server; try { // Get connection to Solr server server = new CommonsHttpSolrServer(url); // Set XMLResponseParser : Reqd for older version of Solr 1.3 server.setParser(new XMLResponseParser()); server.setSoTimeout(1000); // socket read timeout server.setConnectionTimeout(100); server.setDefaultMaxConnectionsPerHost(100); server.setMaxTotalConnections(100); server.setFollowRedirects(false); // defaults to false // allowCompression defaults to false. // Server side must support gzip or deflate for this to have any effect. server.setAllowCompression(true); server.setMaxRetries(1); // defaults to 0. 1 not recommended. // WARNING : this will delete all pre-existing Solr index //server.deleteByQuery( *:* );// delete everything! SolrInputDocument doc = new SolrInputDocument(); doc.addField(id, pageId ); doc.addField(features, rawText ); // Add the docs to Solr Server server.add(doc); // Do commit the changes server.commit(); }catch (Exception e) {} } In the above the param rawText is just the html stripped off of all its tags, js, css etc and pageId is the Url for that page. When I'm using this for English pages its working perfectly fine but the problem comes up when I'm trying to index some non-english pages. For them, say pages in tamil, the encoding Unicode/Utf-8 seems to create some problem, because after indexing some non-english pages when I'm trying to search those from solr admin search interface, it gives the result but the content is not showing in that language i.e tamil rather it just displays just some characters, i think in unicode. The same thing worked fine for pages in English. Now what I did is just extracted the raw text from that html page and manually created an xml page like this ?xml version=1.0 encoding=UTF-8? add doc field name=idUTF2TEST/field field name=nameTest with some UTF-8 encoded characters/field field name=features*some tamil unicode text here*/field /doc /add and posted this from command line using the post.jar file. Now searching gives me the result but unlike last time browser shows the indexed text in tamil itself and not the raw unicode. So this clearly shows that the string that I'm using to create the solrDoc seems to have some encoding issues, right? Or something else? I tried doing something like this also, // Encode in Unicode UTF-8 utfEncodedText = new String(rawText.getBytes(UTF-8)); but even this didn't help eighter. Its seems some silly problem some where, which I'm not able to catch. :-) I appreciate if some one can point me the bug... Thanks, Ahmed.
Re: How to post in-memory[not residing on local disks] Xml files to Solr server for indexing?
As far as I know, Maven is a build/mgmt tool for java projects quite similar to Ant, right? No I'm not using this , then I think I don't need to worry about those pom files. But I'm still not able to figure out the error with classpath/jar files I mentioned in my previous mails. Shall I try getting those jar files, specifically that solr-solrj jar that contains commons-http-solr-server class files? If yes then can you tell me where to get those jar files from, on the web? Has anyone ever faced similar problems? Please help me fixing these silly issues? Thanks, Ahmed. On Mon, Apr 27, 2009 at 6:59 PM, Shalin Shekhar Mangar shalinman...@gmail.com wrote: On Mon, Apr 27, 2009 at 6:27 PM, ahmed baseet ahmed.bas...@gmail.com wrote: Can anyone help me selecting the proper pom.xml file out of the bunch of *-pom.xml.templates available. Ahmed, are you using Maven? If not, then you do not need these pom files. If you are using Maven, then you need to add a dependency to solrj. http://wiki.apache.org/solr/Solrj#head-674dd7743df665fdd56e8eccddce16fc2de20e6e -- Regards, Shalin Shekhar Mangar.
Re: How to post in-memory[not residing on local disks] Xml files to Solr server for indexing?
Thank you very much. Now its working fine, fixed those minor classpath issues. Thanks, Ahmed. 2009/4/28 Noble Paul നോബിള് नोब्ळ् noble.p...@gmail.com the Solr distro contains all the jar files. you can take either the latest release (1.3) or a nightly On Tue, Apr 28, 2009 at 11:34 AM, ahmed baseet ahmed.bas...@gmail.com wrote: As far as I know, Maven is a build/mgmt tool for java projects quite similar to Ant, right? No I'm not using this , then I think I don't need to worry about those pom files. But I'm still not able to figure out the error with classpath/jar files I mentioned in my previous mails. Shall I try getting those jar files, specifically that solr-solrj jar that contains commons-http-solr-server class files? If yes then can you tell me where to get those jar files from, on the web? Has anyone ever faced similar problems? Please help me fixing these silly issues? Thanks, Ahmed. On Mon, Apr 27, 2009 at 6:59 PM, Shalin Shekhar Mangar shalinman...@gmail.com wrote: On Mon, Apr 27, 2009 at 6:27 PM, ahmed baseet ahmed.bas...@gmail.com wrote: Can anyone help me selecting the proper pom.xml file out of the bunch of *-pom.xml.templates available. Ahmed, are you using Maven? If not, then you do not need these pom files. If you are using Maven, then you need to add a dependency to solrj. http://wiki.apache.org/solr/Solrj#head-674dd7743df665fdd56e8eccddce16fc2de20e6e -- Regards, Shalin Shekhar Mangar. -- --Noble Paul
How to post in-memory[not residing on local disks] Xml files to Solr server for indexing?
Hi All, I'm trying to post some files to Solr server. I've done this using the post.jar files for posting xml files residing on my local disk[I tried posting all those xml files from example directory]. Now I'm trying to generate xml files on the fly, with required text to be indexed included therein though, and want to post these files to solr. As per the examples we've used SimplePostTool for posting locally resinding files but can some one give me direction on indexing in-memory xml files[files generated on the fly]. Actually I want to automate this process in a loop, so that I'll extract some information and put that to xml file and push it off to Solr for indexing. Thanks in appreciation. --Ahmed.
Re: How to post in-memory[not residing on local disks] Xml files to Solr server for indexing?
Hi, After going through the solrj wiki I found that we've to set some dependencies in pom.xml for using Solrj, which I haven't done yet. So I googled to know how to do that but no help. I searched the solr directory and found a bunch of *-pom.template files [like solr-core-pom.xml, solr-solrj-pom.xml etc] and I'm not able to figure out which one to use. Any help would be appreciated. Thanks, Ahmed. On Mon, Apr 27, 2009 at 4:53 PM, ahmed baseet ahmed.bas...@gmail.comwrote: Shalin, thanks for your quick response. Actually I'm trying to pull plaintext from html pages and trying to make xml files for each page. I went through the SolrJ webpage and found that the we've to add all the field and its contents anyway, right? but yes it makes adding/updating etc quite easier than using that SimplePostTool. I tried to use SolrJ client but it doesnot seem to be working. I added all the jar files mentioned in SolrJ wiki to classpath but still its giving me some error. To be precise it gives me the following error, .cannot find symbol: symbol : class CommonsHttpSolrServer I rechecked to make sure that commons-httpclient-3.1.jar is in the class path. Can someone please point me what is the issue? I'm working on Windows and my classpath variable is this: .;E:\Program Files\Java\jdk1.6.0_05\bin;D:\firefox download\apache-solr-1.3.0\apache-solr-1.3.0\dist\solrj-lib\commons-httpclient-3.1.jar;D:\firefox download\apache-solr-1.3.0\apache-solr-1.3.0\dist\solrj-lib\apache-solr-common.jar;D:\firefox download\apache-solr-1.3.0\apache-solr-1.3.0\dist\solrj-lib\apache-solr-1.3.0.jar;D:\firefox download\apache-solr-1.3.0\apache-solr-1.3.0\dist\solrj-lib\solr-solrj-1.3.0.jar;D:\firefox download\apache-solr-1.3.0\apache-solr-1.3.0\dist\solrj-lib\commons-io-1.3.1.jar;D:\firefox download\apache-solr-1.3.0\apache-solr-1.3.0\dist\solrj-lib\commons-codec-1.3.jar;D:\firefox download\apache-solr-1.3.0\apache-solr-1.3.0\dist\solrj-lib\commons-logging-1.0.4.jar Thank you very much. Ahmed. On Mon, Apr 27, 2009 at 3:55 PM, Shalin Shekhar Mangar shalinman...@gmail.com wrote: On Mon, Apr 27, 2009 at 3:30 PM, ahmed baseet ahmed.bas...@gmail.com wrote: Hi All, I'm trying to post some files to Solr server. I've done this using the post.jar files for posting xml files residing on my local disk[I tried posting all those xml files from example directory]. Now I'm trying to generate xml files on the fly, with required text to be indexed included therein though, and want to post these files to solr. As per the examples we've used SimplePostTool for posting locally resinding files but can some one give me direction on indexing in-memory xml files[files generated on the fly]. Actually I want to automate this process in a loop, so that I'll extract some information and put that to xml file and push it off to Solr for indexing. Thanks in appreciation. You can use the Solrj client to avoid building the intermediate XML yourself. Extract the information, use the Solrj api to add the extracted text to fields and send them to the solr server. http://wiki.apache.org/solr/Solrj -- Regards, Shalin Shekhar Mangar.
Re: How to post in-memory[not residing on local disks] Xml files to Solr server for indexing?
Can anyone help me selecting the proper pom.xml file out of the bunch of *-pom.xml.templates available. I got the following when searched for pom.xml files, solr-common-csv-pom.xml solr-lucene-analyzers-pom.xml solr-lucene-contrib-pom.xml solr-lucene-*-pom.xml [ a lot of solr-lucene-... pom files are available, hence shortened to avoid typing all] solr-dataimporthandler-pom.xml solr-common-pom.xml solr-core-pom.xml solr-parent-pom.xml solr-solr-pom.xml Thanks, Ahmed. On Mon, Apr 27, 2009 at 5:38 PM, Shalin Shekhar Mangar shalinman...@gmail.com wrote: On Mon, Apr 27, 2009 at 4:53 PM, ahmed baseet ahmed.bas...@gmail.com wrote: To be precise it gives me the following error, .cannot find symbol: symbol : class CommonsHttpSolrServer I rechecked to make sure that commons-httpclient-3.1.jar is in the class path. Can someone please point me what is the issue? I'm working on Windows and my classpath variable is this: .;E:\Program Files\Java\jdk1.6.0_05\bin;D:\firefox download\apache-solr-1.3.0\apache-solr-1.3.0\dist\solrj-lib\commons-httpclient-3.1.jar;D:\firefox download\apache-solr-1.3.0\apache-solr-1.3.0\dist\solrj-lib\apache-solr-common.jar;D:\firefox download\apache-solr-1.3.0\apache-solr-1.3.0\dist\solrj-lib\apache-solr-1.3.0.jar;D:\firefox download\apache-solr-1.3.0\apache-solr-1.3.0\dist\solrj-lib\solr-solrj-1.3.0.jar;D:\firefox download\apache-solr-1.3.0\apache-solr-1.3.0\dist\solrj-lib\commons-io-1.3.1.jar;D:\firefox download\apache-solr-1.3.0\apache-solr-1.3.0\dist\solrj-lib\commons-codec-1.3.jar;D:\firefox download\apache-solr-1.3.0\apache-solr-1.3.0\dist\solrj-lib\commons-logging-1.0.4.jar The jars look right. It is likely a problem with your classpath. CommonsHttpSolrServer is in the solr-solrj jar. If you are using Maven, then you'd need to change your pom.xml -- Regards, Shalin Shekhar Mangar.
How to indexing non-english html text in unicode with Solr?
Hi All, I'm trying to index some regional/non-eng html pages with Solr. I thought of indexing the corresponding unicode text for that page as Solr supports Unicode indexing, right? But I'm not able to extract Xml from the html page, because for posting to Solr we require Xml. Can anyone tell me any good method of extracting Xml from html or just let me know how to index non-english html pages with Solr that will enable me searching with unicode queries (for corresponding regional query). Thanks in advance. --Ahmed.