Without you stopping Solr itself, a solr client can remove all the documents in an index by doing a delete-by-query with the query "*:*" (without quotes). For XML interface clients, see http://wiki.apache.org/solr/UpdateXmlMessage. Solrj would have another way to do it. You'll need to do a commit after this to flush your changes.
Alternatively, you can stop Solr and delete the whole data/ directory, which includes the index directory. If you do this, Solr will create a new fresh one the next time it starts up. For backups it might be a better habit to backup the data/ directory, rather than just the data/index directory. Assuming your schema.xml hasn't changed, then you should be able to restore one data/ directory with another. If you're changing your schema file, though, you need to make sure you restore a version of that file that is consistent with the one that you indexed with. On Sat, Jan 24, 2009 at 5:43 PM, Johnny X <jonathanwel...@gmail.com> wrote: > > Thanks for the reply. > > I ended up fixing it by re-installing Tomcat and starting over. Searches now > appear to work. > > Because I'm testing atm however, is it possible to delete the index and > start afresh in future. > > At the moment I backed up the original index folder...if I just replace that > with the current one including an index will that work...or will other parts > of Solr recognise it's changed and as a result not work? > > What's the best solution for removing the index? > > > Cheers. > > > > ryguasu wrote: >> >> I should clarify that I misspoke before; I thought you had >> indexed="true" on Message-Id and Date, whereas you had it on >> Message-Id and Content. It sounds like you figured this out and >> interpreted my reply in a useful way nonetheless, though. So that's >> good. >> >> The post tool should be a valid way to commit. >> >> As for your technique of updating the field types and reindexing the >> documents, I think it should be fine provided you kept the field type >> for the Message-Id field as string. If you changed it to text along >> with the other field types, then there's a chance your "update" >> technique might instead of the effect of inserting a duplicate copy of >> each document, so there are two copies of each document, one >> searchable, and one not searchable. (I'm not totally sure about this, >> but it's a worry I would have.) That doesn't sound like what's >> happened to you, though. >> >> Could the problem be that you're not specifying which field to query? >> If you're using the standard query analyzer and the stock schema.xml, >> then the default field name is "text", whereas you don't have a field >> called "text" in your schema. In that setup if you want to search on >> the Content field you need to say so explicitly, like so: >> >> Content:phillip >> >> On Sat, Jan 24, 2009 at 7:25 AM, Johnny X <jonathanwel...@gmail.com> >> wrote: >>> >>> If it helps, everything appears when I use Luke to search through the >>> index...but the search in that returns nothing either. >>> >>> When I search using the admin page for the word 'Phillip' (which appears >>> the >>> most in all of the documents) I get the following: >>> >>> <?xml version="1.0" encoding="UTF-8" ?> >>> - <response> >>> - <lst name="responseHeader"> >>> <int name="status">0</int> >>> <int name="QTime">0</int> >>> - <lst name="params"> >>> <str name="indent">on</str> >>> <str name="start">0</str> >>> <str name="q">phillip</str> >>> <str name="rows">10</str> >>> <str name="version">2.2</str> >>> </lst> >>> </lst> >>> <result name="response" numFound="0" start="0" /> >>> </response> >>> >>> >>> Duh...? >>> >>> >>> >>> Johnny X wrote: >>>> >>>> They all appear in the stats admin page under the NumDocs & maxDocs >>>> fields. >>>> >>>> I don't explicitly send a commit command, but my posting ends like this >>>> (suggesting they are commited): >>>> >>>> SimplePostTool: POSTing file 21166.xml >>>> SimplePostTool: POSTing file 21169.xml >>>> SimplePostTool: COMMITting Solr index changes.. >>>> >>>> I just tried re-posting all the documents set as "text" -- will that >>>> update the current documents indexed? (bearing in mind the unique key, >>>> message-id, will be included again) >>>> >>>> When I try searching I still get 0 results for anything included in the >>>> message-id and content fields, both of which should be indexed and >>>> returning results... >>>> >>>> >>>> Cheers for any help! >>>> >>>> >>>> ryguasu wrote: >>>>> >>>>> These might be obvious, but: >>>>> >>>>> * I assume you did a Solr commit command after indexing, right? >>>>> >>>>> * If you are using the fieldtype definitions from the default >>>>> schema.xml, then your "string" fields are not being analyzed, which >>>>> means you should expect search results only if you enter the entire, >>>>> exact value of one of the Message-ID or Date fields in your query. Is >>>>> that your intention? >>>>> >>>>> And yes, your analysis of "stored" seems correct. Stored fields are >>>>> those whose values you need back at query time, and indexed fields are >>>>> those you can do queries on. For a few complications, see >>>>> http://wiki.apache.org/solr/FieldOptionsByUseCase >>>>> >>>>> On Fri, Jan 23, 2009 at 8:04 PM, Johnny X <jonathanwel...@gmail.com> >>>>> wrote: >>>>>> >>>>>> I've indexed my XML using the below in the schema: >>>>>> >>>>>> <field name="Message-ID" type="string" indexed="true" stored="true" >>>>>> required="true"/> >>>>>> <field name="Date" type="string" indexed="false" stored="true"/> >>>>>> <field name="From" type="string" indexed="false" stored="true"/> >>>>>> <field name="To" type="string" indexed="false" stored="true"/> >>>>>> <field name="Subject" type="string" indexed="false" stored="true"/> >>>>>> <field name="Mime-Version" type="string" indexed="false" >>>>>> stored="true"/> >>>>>> <field name="Content-Type" type="string" indexed="false" >>>>>> stored="true"/> >>>>>> <field name="Content-Transfer-Encoding" type="string" >>>>>> indexed="false" >>>>>> stored="true"/> >>>>>> <field name="X-From" type="string" indexed="false" stored="true"/> >>>>>> <field name="X-To" type="string" indexed="false" stored="true"/> >>>>>> <field name="X-cc" type="string" indexed="false" stored="true"/> >>>>>> <field name="X-bcc" type="string" indexed="false" stored="true"/> >>>>>> <field name="X-Folder" type="string" indexed="false" stored="true"/> >>>>>> <field name="X-Origin" type="string" indexed="false" stored="true"/> >>>>>> <field name="X-FileName" type="string" indexed="false" >>>>>> stored="true"/> >>>>>> <field name="Content" type="string" indexed="true" stored="true"/> >>>>>> >>>>>> <uniqueKey>Message-ID</uniqueKey> >>>>>> >>>>>> However searching via the Message-ID or Content fields returns 0. >>>>>> Using >>>>>> Luke >>>>>> I can still see these fields are stored however. >>>>>> >>>>>> Out of interest, by setting the other fields to just "stored=true", >>>>>> can >>>>>> they >>>>>> be returned in a query as part of a search? >>>>>> >>>>>> >>>>>> Cheers. >>>>>> -- >>>>>> View this message in context: >>>>>> http://www.nabble.com/Results-not-appearing-tp21637069p21637069.html >>>>>> Sent from the Solr - User mailing list archive at Nabble.com. >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> >>> >>> -- >>> View this message in context: >>> http://www.nabble.com/Results-not-appearing-tp21637069p21641692.html >>> Sent from the Solr - User mailing list archive at Nabble.com. >>> >>> >> >> > > -- > View this message in context: > http://www.nabble.com/Results-not-appearing-tp21637069p21647649.html > Sent from the Solr - User mailing list archive at Nabble.com. > >