Hi Federica,

You are right that the object is reindexed, if the <IndexDocument> contains 
<IndexField>s, so you could avoid generating IndexFields, when you want to 
delete.

Best,
Gert


On 17/05/2011, at 11.12, Federica Bertozzi wrote:

Hi Gert,

I have tried to change the xslt with this:

<xsl:value-of select="extsmia:updateIndexDeletePid($PID, 'localhost', '8080', 
'fedoragsearch')"/>

and the java method is:

public static String updateIndexDeletePid(String pid, String hostname, String 
port, String gsearchappname) {
        try {
            URL url = null;
            url = new URL("http://";<http:/> + hostname + ":" + port + "/" + 
gsearchappname + "/rest?operation=updateIndex&action=deletePid&value=" + pid + 
"&restXslt=copyXml");
            URLConnection conn = conn = url.openConnection();
            conn.setRequestProperty("Authorization", "Basic "+(new 
BASE64Encoder()).encode((System.getProperty("fedoragsearch.fgsUserName")+":"+System.getProperty("fedoragsearch.fgsPassword")).getBytes()));
              conn.connect();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "";
}

If I try this method from java main, the object is removed from index, but it 
doesn't work from xslt when it is started by jms .
I have checked the dk.defxws.fedoragsearch.server.UpdateListener class, the 
onMessage method calls fedoragsearch with action=frompid when the jms is 
managed and so I think that the object is re-indexed and so 
updateIndexDelatePid call doesn't have any effects.

Thanks very much

Federica



On 05/16/2011 02:09 PM, Gert Schmeltz Pedersen wrote:
Hi Federica,

The format of index documents depends on the plugin search engine, for 
fgslucene the root element is <IndexDocument>, for fgssolr the root element is 
<add>. The <delete> element belongs to the solr format. Your generated index 
document is a mixture, having <IndexDocument> and <delete>, therefore not 
valid. If you use fgslucene you have to send an updateIndex deletePid, when you 
update the state of a fedora object to Inactive or Deleted.

Best,
Gert


On 16/05/2011, at 13.15, Federica Bertozzi wrote:

Hi Gert,

this is the result actually generated:

<?xml version="1.0" encoding="UTF-8"?>
<IndexDocument 
xmlns:uvalibadmin="http://dl.lib.virginia.edu/bin/admin/admin.dtd/";<http://dl.lib.virginia.edu/bin/admin/admin.dtd/>
 
xmlns:uvalibdesc="http://dl.lib.virginia.edu/bin/dtd/descmeta/descmeta.dtd";<http://dl.lib.virginia.edu/bin/dtd/descmeta/descmeta.dtd>
 
xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/";<http://www.openarchives.org/OAI/2.0/oai_dc/>
 xmlns:dc="http://purl.org/dc/elements/1.1/";<http://purl.org/dc/elements/1.1/> 
xmlns:foxml="info:fedora/fedora-system:def/foxml#"<info:fedora/fedora-system:def/foxml#>
 xmlns:zs="http://www.loc.gov/zing/srw/";<http://www.loc.gov/zing/srw/> 
PID="mag:8" boost="3.5">
<delete>
<id>mag:8</id>
</delete>
</IndexDocument>

The fedoragsearch.log reports this when I change the object state from Active 
to Deleted:

DEBUG 2011-05-16 13:13:14,991 (UpdateListener) Received Fedora Message: 
ActiveMQTextMessage {commandId = 24, responseRequired = true, messageId = 
ID:matrix-32940-1305543937581-2:0:1:1:8, originalDestination = null, 
originalTransactionId = null, producerId = 
ID:matrix-32940-1305543937581-2:0:1:1, destination = 
topic://fedora.apim.update, transactionId = null, expiration = 0, timestamp = 
1305544394987, arrival = 0, brokerInTime = 1305544394987, brokerOutTime = 
1305544394989, correlationId = null, replyTo = null, persistent = true, type = 
null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, 
compressed = false, userID = null, content = 
org.apache.activemq.util.ByteSequence@15ae101, marshalledProperties = 
org.apache.activemq.util.ByteSequence@16a16ae, dataStructure = null, 
redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = true, 
readOnlyBody = true, droppable = false, text = null}
DEBUG 2011-05-16 13:13:14,991 (UpdateListener) Message Text: <?xml 
version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom";<http://www.w3.org/2005/Atom> 
xmlns:xsd="http://www.w3.org/2001/XMLSchema";<http://www.w3.org/2001/XMLSchema> 
xmlns:fedora-types="http://www.fedora.info/definitions/1/0/types/";<http://www.fedora.info/definitions/1/0/types/>>
  <id>urn:uuid:4e240e3f-7800-4278-a271-acd9f9740a3d</id>
  <updated>2011-05-16T11:13:14.935Z</updated>
  <author>
    <name>fedoraAdmin</name>
    <uri>http://localhost:8080/fedora</uri>
  </author>
  <title type="text">modifyObject</title>
  <category term="mag:8" scheme="fedora-types:pid" 
label="xsd:string"></category>
  <category term="D" scheme="fedora-types:state" label="xsd:string"></category>
  <category term="prova 8" scheme="fedora-types:label" 
label="xsd:string"></category>
  <category term="null" scheme="fedora-types:logMessage" 
label="xsd:string"></category>
  <summary type="text">mag:8</summary>
  <content type="text">2011-05-16T11:13:14.934Z</content>
  <category term="3.3" 
scheme="info:fedora/fedora-system:def/view#version"<info:fedora/fedora-system:def/view#version>></category>
  <category 
term="info:fedora/fedora-system:ATOM-APIM-1.0"<info:fedora/fedora-system:ATOM-APIM-1.0>
 
scheme="http://www.fedora.info/definitions/1/0/types/formatURI";<http://www.fedora.info/definitions/1/0/types/formatURI>></category>
</entry>
DEBUG 2011-05-16 13:13:14,996 (GenericOperationsImpl) updateIndex 
action=fromPid value=mag:8 repositoryName=BasicRepos indexNames= indexDocXslt= 
resultPageXslt=
DEBUG 2011-05-16 13:13:14,996 (Config) indexName=BasicIndex 
operationsImpl=dk.defxws.fgslucene.OperationsImpl
DEBUG 2011-05-16 13:13:14,996 (Config) operationsImplClass=class 
dk.defxws.fgslucene.OperationsImpl
DEBUG 2011-05-16 13:13:14,997 (Config) 
ops=dk.defxws.fgslucene.OperationsImpl@197cf78
DEBUG 2011-05-16 13:13:14,999 (OperationsImpl) getIndexReader 
indexName=BasicIndex docCount=4
INFO 2011-05-16 13:13:14,999 (GenericOperationsImpl) getFoxmlFromPid pid=mag:8 
repositoryName=BasicRepos
DEBUG 2011-05-16 13:13:15,033 (GTransformer) 
xsltName=config/index/BasicIndex/basicFoxmlToLucene
DEBUG 2011-05-16 13:13:15,060 (OperationsImpl) IndexDocument=
<?xml version="1.0" encoding="UTF-8"?>
<IndexDocument 
xmlns:uvalibadmin="http://dl.lib.virginia.edu/bin/admin/admin.dtd/";<http://dl.lib.virginia.edu/bin/admin/admin.dtd/>
 
xmlns:uvalibdesc="http://dl.lib.virginia.edu/bin/dtd/descmeta/descmeta.dtd";<http://dl.lib.virginia.edu/bin/dtd/descmeta/descmeta.dtd>
 
xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/";<http://www.openarchives.org/OAI/2.0/oai_dc/>
 xmlns:dc="http://purl.org/dc/elements/1.1/";<http://purl.org/dc/elements/1.1/> 
xmlns:foxml="info:fedora/fedora-system:def/foxml#"<info:fedora/fedora-system:def/foxml#>
 xmlns:zs="http://www.loc.gov/zing/srw/";<http://www.loc.gov/zing/srw/> 
PID="mag:8" boost="3.5">
<delete>
<id>mag:8</id>
</delete>
</IndexDocument>

WARN 2011-05-16 13:13:15,062 (OperationsImpl) IndexDocument mag:8 does not 
contain any IndexFields!!! RepositoryName=BasicRepos IndexName=BasicIndex
DEBUG 2011-05-16 13:13:15,062 (OperationsImpl) getIndexReader 
indexName=BasicIndex docCount=4
DEBUG 2011-05-16 13:13:15,062 (OperationsImpl) closeIndexReader 
indexName=BasicIndex docCount=4
INFO 2011-05-16 13:13:15,062 (OperationsImpl) updateIndex fromPid 
indexName=BasicIndex indexDirSpace=6796 docCount=4
DEBUG 2011-05-16 13:13:15,063 (GTransformer) 
xsltName=config/index/BasicIndex/updateIndexToResultPage
DEBUG 2011-05-16 13:13:15,071 (GenericOperationsImpl) resultXml=<?xml 
version="1.0" encoding="UTF-8"?>
<resultPage operation="updateIndex" action="fromPid" value="mag:8" 
repositoryName="BasicRepos" indexNames="" resultPageXslt="" dateTime="Mon May 
16 13:13:14 CEST 2011">
<updateIndex 
xmlns:dc="http://purl.org/dc/elements/1.1/";<http://purl.org/dc/elements/1.1/> 
xmlns:foxml="info:fedora/fedora-system:def/foxml#"<info:fedora/fedora-system:def/foxml#>
 xmlns:zs="http://www.loc.gov/zing/srw/";<http://www.loc.gov/zing/srw/> 
warnCount="0" docCount="4" deleteTotal="0" updateTotal="0" insertTotal="0" 
indexName="BasicIndex"/>
</resultPage>

INFO 2011-05-16 13:13:15,072 (UpdateListener) Index updated by notification 
message, returning:
<?xml version="1.0" encoding="UTF-8"?>
<resultPage operation="updateIndex" action="fromPid" value="mag:8" 
repositoryName="BasicRepos" indexNames="" resultPageXslt="" dateTime="Mon May 
16 13:13:14 CEST 2011">
<updateIndex 
xmlns:dc="http://purl.org/dc/elements/1.1/";<http://purl.org/dc/elements/1.1/> 
xmlns:foxml="info:fedora/fedora-system:def/foxml#"<info:fedora/fedora-system:def/foxml#>
 xmlns:zs="http://www.loc.gov/zing/srw/";<http://www.loc.gov/zing/srw/> 
warnCount="0" docCount="4" deleteTotal="0" updateTotal="0" insertTotal="0" 
indexName="BasicIndex"/>
</resultPage>



Thanks
Federica


On 05/16/2011 12:51 PM, Gert Schmeltz Pedersen wrote:
Hi Federica,

What is actually generated by the indexing stylesheet?

Best,
Gert


On 16/05/2011, at 11.25, Federica Bertozzi wrote:

Hi,

I use GSerach with Fedora 3.3, synchronized with JMS.
How can I remove from index an object when its state change from Active to 
Deleted?
I add this code (I take this from here 
http://fedora-commons.1317035.n2.nabble.com/fcrepo-dev-Deleting-one-index-document-tc5835362.html#none,
 which treated a similar problem, with inactive instead of deleted state) in 
fedoragsearch/WEB-INF/classes/config/index/BasicIndex/basicFoxmlToLucene.xslt, 
but it doesn't work:

...
<xsl:template match="/">
        <IndexDocument>
            <!-- The PID attribute is mandatory for indexing to work -->
            <xsl:attribute name="PID">
                <xsl:value-of select="$PID"/>
            </xsl:attribute>
            <xsl:attribute name="boost">
                <xsl:value-of select="$docBoost"/>
            </xsl:attribute>

            <!-- The following allows only active FedoraObjects to be indexed. 
-->

            ...

            <!-- The following allows deleted mag FedoraObjects to be deleted 
from the index. -->
            <xsl:if 
test="foxml:digitalObject/foxml:objectProperties/foxml:property[@NAME='info:fedora/fedora-system:def/model#state'
 and @VALUE='Deleted']">
                <xsl:if 
test="not(foxml:digitalObject/foxml:datastream[@ID='METHODMAP'] or 
foxml:digitalObject/foxml:datastream[@ID='DS-COMPOSITE-MODEL'])">
                    <xsl:if test="starts-with($PID,'mag:')">
                        <xsl:apply-templates mode="deletedFedoraObject"/>
                    </xsl:if>
                </xsl:if>
            </xsl:if>

        </IndexDocument>
    </xsl:template>
...
<xsl:template match="/foxml:digitalObject" mode="deletedFedoraObject">
      <delete>
          <id><xsl:value-of select="$PID"/></id>
      </delete>
</xsl:template>
...

Thanks


--
Federica

<ATT00001.c><ATT00002.c>



------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay


_______________________________________________
Fedora-commons-users mailing list
Fedora-commons-users@lists.sourceforge.net<mailto:Fedora-commons-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/fedora-commons-users




--
Federica Bertozzi

<ATT00001.c><ATT00002.c>



------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay


_______________________________________________
Fedora-commons-users mailing list
Fedora-commons-users@lists.sourceforge.net<mailto:Fedora-commons-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/fedora-commons-users




--
Federica Bertozzi

<ATT00001.c><ATT00002.c>

------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Fedora-commons-users mailing list
Fedora-commons-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fedora-commons-users

Reply via email to