[TYPO3-Solr] Delete all records for domain from index

Jigal van Hemert jigal.van.hemert at typo3.org
Wed Aug 5 16:24:17 CEST 2015


Hi,

On 05/08/2015 15:31, Dennis Luemkemann wrote:
> during the setup of a web project, I had a different server name for
> my site than now, in production mode. So the solr index now contains
> all records twice, once for domain test.mydomain.com and once for
> www.mydomain.com. While it’s not a real problem (only records for the
> current domain are returned when querying), i hate to have 16000
> entries sitting there taking up space that will never be used again.
>
> What’s the best way to clear these records out of the Solr index?

For the more adventurous people: you can delete records from the index 
based on a solr query in the solr server admin interface.

(Based on the interface of solr server 4.8.x; earlier releases needed 
some URL magic *) )

- Use the core selector on the Dashboard to chose your core.
- Select "Query" in the menu below the core selector
- build a query in the "q" field that selects the records you want to 
remove (maybe "site:test.mydomain.com")
- Select "Documents" in the menu and "XML" as Document Type (other 
fields are by default:
   * Request-Handler (qt) : /update
   * Commit within : 1000
   * Overwrite : true
- Put in the Document(s) field:

<update><delete><query>site:test.mydomain.com</query></delete><commit/></update>

(this example uses the same query as you tested in the Query screen earlier)

- hit the Submit Document button



*) for older solr server versions without the interface mentioned above 
you could add an update command in the URL in your browser:

http://localhost:8080/solr/core_en/update?stream.body=<update><delete><query>type:tt_news</query></delete><commit/></update> 


(example to delete documents of type 'tt_news' from the core 'core_en' 
on the solr server on localhost)

-- 
Jigal van Hemert
TYPO3 CMS Active Contributor

TYPO3 .... inspiring people to share!
Get involved: typo3.org


More information about the TYPO3-project-solr mailing list