I have realized this is not specific to SolrJ but to my instance of Solr.
Using curl to delete by query is not working either.

Running
curl http://localhost:8983/solr/coupon/update -H "Content-Type: text/xml"
--data-binary '<delete><query>*:*</query></delete>'

Yields this in the logs:
INFO: [coupon] webapp=/solr path=/update
params={stream.body=<delete><query>*:*</query></delete>}
{deleteByQuery=*:*} 0 0

But the corpus of documents in the core do not change.

My solrconfig is pretty barebones at this point, but I attached it in case
anyone sees something strange. Anyone have any idea why documents aren't
getting deleted?

Thanks in advance,
Briggs Thompson

On Wed, Jul 18, 2012 at 12:54 PM, Briggs Thompson <
w.briggs.thomp...@gmail.com> wrote:

> Hello All,
>
> I am using 4.0 Alpha and running into an issue with indexing using
> HttpSolrServer (SolrJ).
>
> Relevant java code:
>             HttpSolrServer solrServer = new HttpSolrServer(MY_SERVER);
>             solrServer.setRequestWriter(new BinaryRequestWriter());
>
> Relevant Solrconfig.xml content:
>
>   <requestHandler name="/update" class="solr.UpdateRequestHandler"  />
>
>   <requestHandler name="/update/javabin"
> class="solr.BinaryUpdateRequestHandler" />
>
> Indexing documents works perfectly fine (using addBeans()), however, when
> trying to do deletes I am seeing issues. I tried to do
> a solrServer.deleteByQuery("*:*") followed by a commit and optimize, and
> nothing is deleted.
>
> The response from delete request is a "success", and even in the solr logs
> I see the following:
>
> INFO: [coupon] webapp=/solr path=/update/javabin
> params={wt=javabin&version=2} {deleteByQuery=*:*} 0 1
> Jul 18, 2012 11:15:34 AM org.apache.solr.update.DirectUpdateHandler2 commit
> INFO: start
> commit{flags=0,version=0,optimize=true,openSearcher=true,waitSearcher=false,expungeDeletes=false,softCommit=false}
>
>
>
> I tried removing the binaryRequestWriter and have the request send out in
> default format, and I get the following error.
>
> SEVERE: org.apache.solr.common.SolrException: Unsupported ContentType:
> application/octet-stream  Not in: [application/xml, text/csv, text/json,
> application/csv, application/javabin, text/xml, application/json]
>
> at
> org.apache.solr.handler.UpdateRequestHandler$1.load(UpdateRequestHandler.java:86)
> at
> org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:74)
>  at
> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
> at org.apache.solr.core.SolrCore.execute(SolrCore.java:1561)
>  at
> org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:442)
> at
> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:263)
>  at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>  at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
>  at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
>  at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
>  at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
> at
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
>  at
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
> at
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
>  at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>  at java.lang.Thread.run(Thread.java:636)
>
>
> I thought that an optimize does the same thing as expungeDeletes, but in
> the log I see expungeDeletes=false. Is there a way to force that using
> SolrJ?
>
> Thanks in advance,
> Briggs
>
>
<?xml version="1.0" encoding="UTF-8" ?>
<!--
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
 this work for additional information regarding copyright ownership.
 The ASF licenses this file to You under the Apache License, Version 2.0
 (the "License"); you may not use this file except in compliance with
 the License.  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->

<!--
 This is a stripped down config file used for a simple example...  
 It is *not* a good example to work from. 
-->
<config>
  <luceneMatchVersion>LUCENE_40</luceneMatchVersion>
  <!--  The DirectoryFactory to use for indexes.
        solr.StandardDirectoryFactory, the default, is filesystem based.
        solr.RAMDirectoryFactory is memory based, not persistent, and doesn't work with replication. -->
  <directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.StandardDirectoryFactory}"/>

  <dataDir>${solr.data.dir:}</dataDir>

  <lib dir="${solr.shared.lib:/opt/solr/lib/}" />

  <updateHandler class="solr.DirectUpdateHandler2">
    <autoCommit> 
		<maxTime>${autoCommitTime:0}</maxTime> 
        <openSearcher>false</openSearcher> 
    </autoCommit>
    <autoSoftCommit> 
		<maxTime>${autoSoftCommitTime:0}</maxTime> 
    </autoSoftCommit>
    <updateLog>
		<str name="dir">${solr.data.dir:}</str>
    </updateLog>
  </updateHandler>

  <!-- realtime get handler, guaranteed to return the latest stored fields 
    of any document, without the need to commit or open a new searcher. The current 
    implementation relies on the updateLog feature being enabled. -->
  <requestHandler name="/get" class="solr.RealTimeGetHandler">
    <lst name="defaults">
      <str name="omitHeader">true</str>
    </lst>
  </requestHandler>
  
   <requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
    <lst name="defaults">
    	<str name="config">solr-data-config.xml</str>
    </lst>
   </requestHandler>
  
  <requestHandler name="/replication" class="solr.ReplicationHandler" startup="lazy">
	   <lst name="master">
	   <str name="enable">${masterEnabled:false}</str> 
		 <str name="replicateAfter">commit</str>
		 <str name="replicateAfter">startup</str>
		 <str name="replicateAfter">optimize</str>
		 <str name="confFiles">schema.xml,stopwords.txt,synonyms.txt</str>
	   </lst>
	   <lst name="slave">
		 <str name="enable">${slaveEnabled:false}</str>
		 <str name="masterUrl">http://${masterServer:localhost}:${port:8983}/solr/${masterCoreName:}/replication</str>
		 <str name="pollInterval">${pollInterval:00:00:15}</str>
	   </lst>
  </requestHandler>
  
  <requestDispatcher handleSelect="true" >
    <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" />
  </requestDispatcher>
  
  <requestHandler name="standard" class="solr.StandardRequestHandler" default="true" />
  <requestHandler name="/analysis/field" startup="lazy" class="solr.FieldAnalysisRequestHandler" />
  <requestHandler name="/update" class="solr.UpdateRequestHandler"  />
  <requestHandler name="/admin/" class="org.apache.solr.handler.admin.AdminHandlers" />

  <requestHandler name="/admin/ping" class="solr.PingRequestHandler">
    <lst name="invariants">
      <str name="q">solrpingquery</str>
    </lst>
    <lst name="defaults">
      <str name="echoParams">all</str>
    </lst>
  </requestHandler>
  
  <query>
      <filterCache class="solr.FastLRUCache"
                 size="${filterCacheSize:0}"
                 initialSize="${filterCacheInitialSize:0}"
                 autowarmCount="${queryCacheAutowarm:0}"/>

    <queryResultCache class="solr.LRUCache"
                     size="${queryCacheSize:0}"
                     initialSize="${queryCacheInitialSize:0}"
                     autowarmCount="${queryCacheAutowarm:0}"/>
   
    <documentCache class="solr.LRUCache"
                    size="${documentCacheSize:0}"
                     initialSize="${documentCacheInitialSize:0}"
                     autowarmCount="${documentCacheAutowarm:0}"/>
  </query>

  <!-- config for the admin interface --> 
  <admin>
    <defaultQuery>solr</defaultQuery>
  </admin>

</config>

Reply via email to