User:Lindenb/Notebook/UMR915/2012/04/06: Difference between revisions

From OpenWetWare
< User:Lindenb‎ | Notebook‎ | UMR915‎ | 2012‎ | 04
Jump to navigationJump to search
(9 intermediate revisions by the same user not shown)
Line 14: Line 14:
rm apache-solr-3.5.0.tgz
rm apache-solr-3.5.0.tgz
</pre>
</pre>
Edit ./apache-solr-3.5.0/example/solr/conf/schema.xml
and add the following FIELDS:
  <field name="go_name" type="text_general" indexed="true" stored="true" multiValued="false"/>
  <field name="go_synonym" type="text_general" indexed="true" stored="true" multiValued="true"/>
  <field name="go_definition" type="text_general" indexed="true" stored="true" multiValued="false"/>
start solr:
    cd apache-solr-3.5.0/example/example
    java -jar start.jar
* download GO/RD from http://archive.geneontology.org/latest-termdb/go_daily-termdb.rdf-xml.gz
* download GO/RD from http://archive.geneontology.org/latest-termdb/go_daily-termdb.rdf-xml.gz


$ xsltproc --novalid ~/go2solr.xsl ~/go_daily-termdb.rdf-xml.gz > ~/jeter.xml
  $ xsltproc --novalid ~/go2solr.xsl ~/go_daily-termdb.rdf-xml.gz > ~/jeter.xml
 
 
<pre><?xml version="1.0" encoding="UTF-8"?>
<add>
  <doc>
    <field name="id">GO:0000001</field>
    <field name="go_name" boost="2">mitochondrion inheritance</field>
    <field name="go_synonym">mitochondrial inheritance</field>
    <field name="go_definition">The distribution of mitochondria, including the mitochondrial genome, into daughter cells after mitosis or meiosis, medi
ated by interactions between mitochondria and the cytoskeleton.</field>
  </doc>
  <doc>
    <field name="id">GO:0000002</field>
    <field name="go_name" boost="2">mitochondrial genome maintenance</field>
    <field name="go_definition">The maintenance of the structure and integrity of the mitochondrial genome; includes replication and segregation of the
mitochondrial chromosome.</field></doc></add></pre>
 
 
index GO:
 
  ~/package/apache-solr-3.5.0/example/exampledocs$
    $ du -hs ~/package/apache-solr-3.5.0/
    136M /home/lindenb/package/apache-solr-3.5.0/
    $ java -jar post.jar  ~/jeter.xml
 
<pre>SimplePostTool: version 1.4
SimplePostTool: POSTing files to http://localhost:8983/solr/update..
SimplePostTool: POSTing file jeter.xml
SimplePostTool: COMMITting Solr index changes..</pre>
 
  $ du -hs ~/package/apache-solr-3.5.0/
  153M /home/lindenb/package/apache-solr-3.5.0/
 
==query
http://localhost:8983/solr/select/?q=go_definition%3Acancer+go_name%3Agenome+-go_definition%3Ametabolism&version=2.2&start=0&rows=10&indent=on
 
<pre><?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader"><int name="status">0</int><int name="QTime">9</int><lst name="params"><str name="q">go_definition:protein</str></lst></lst><result name="response" numFound="3244" start="0"><doc><str name="go_definition">Catalysis of the reaction: octanoyl-[acyl-carrier protein] + protein = protein N6-(octanoyl)lysine + acyl-carrier protein.</str><str name="go_name">lipoyl(octanoyl) transferase activity</str><arr name="go_synonym"><str>LipB</str><str>lipoate/octanoate transferase activity</str><str>lipoyl (octanoyl)-acyl carrier protein:protein transferase activity</str><str>lipoyl (octanoyl)-acyl-carrier-protein-protein N-lipoyltransferase activity</str><str>octanoyl-acyl carrier protein-protein N-octanoyltransferase activity</str><str>octanoyl-acyl-carrier-protein-protein N-octanoyltransferase activity</str><str>octanoyl-acyl-carrier-protein:protein N-octanoyltransferase activity</str></arr><str name="id">GO:0033819</str></doc><doc><str name="go_definition">Catalysis of the reactions: protein serine + H2O = protein serine + phosphate; protein threonine phosphate + H2O = protein threonine + phosphate; and protein tyrosine phosphate + H2O = protein tyrosine + phosphate.</str><str name="go_name">protein tyrosine/serine/threonine phosphatase activity</str><arr name="go_synonym"><str>dual-specificity protein phosphatase</str></arr><str name="id">GO:0008138</str></doc><doc><str name="go_definition">A protein complex that possesses protein farnesyltransferase activity.</str><str name="go_name">protein farnesyltransferase complex</str><str name="id">GO:0005965</str></doc><doc><str name="go_definition">Catalysis of the reaction: palmitoyl-protein + H2O = palmitate + protein.</str><str name="go_name">palmitoyl-(protein) hydrolase activity</str><arr name="go_synonym"><str>palmitoyl-[protein] hydrolase</str><str>palmitoyl-protein hydrolase activity</str><str>palmitoyl-protein thioesterase activity</str><str>palmitoyl-protein thiolesterase activity</str></arr><str name="id">GO:0008474</str></doc><doc><str name="go_definition">Catalysis of the reaction: (protein)-L-serine = (protein)-D-serine.</str><str name="go_name">protein-serine epimerase activity</str><arr name="go_synonym"><str>protein-serine racemase activity</str></arr><str name="id">GO:0018365</str></doc><doc><str name="go_definition">A protein complex that possesses AMP-dependent protein kinase activity.</str><str name="go_name">AMP-activated protein kinase complex</str><arr name="go_synonym"><str>5'-AMP-activated protein kinase complex</str><str>Snf1 kinase complex</str><str>Snf1 serine/threonine protein kinase complex</str></arr><str name="id">GO:0031588</str></doc><doc><str name="go_definition">A protein complex that contains two G-protein coupled receptors.</str><str name="go_name">G-protein coupled receptor dimeric complex</str><arr name="go_synonym"><str>G-protein coupled receptor dimer</str><str>GPCR dimer</str></arr><str name="id">GO:0038037</str></doc><doc><str name="go_definition">Catalysis of the reactions: ATP + protein serine = ADP + protein serine phosphate, and ATP + protein threonine = ADP + protein threonine phosphate.</str><str name="go_name">protein serine/threonine kinase activity</str><arr name="go_synonym"><str>A-kinase activity</str><str>AP50 kinase activity</str><str>ATP-protein transphosphorylase activity</str><str>ATP:protein phosphotransferase (non-specific) activity</str><str>GO:0004695</str><str>GO:0004696</str><str>GO:0004700</str><str>HIPK2</str><str>Hpr kinase activity</str><str>M phase-specific cdc2 kinase activity</str><str>MAPK</str><str>PKA</str><str>PKC</str><str>Prp4 protein kinase activity</str><str>Raf kinase activity</str><str>Raf-1</str><str>STK32</str><str>T-antigen kinase activity</str><str>WEE1Hu</str><str>Wee 1-like kinase activity</str><str>Wee-kinase activity</str><str>atypical PKC activity</str><str>atypical protein kinase C activity</str><str>betaIIPKC</str><str>calcium/phospholipid-dependent protein kinase activity</str><str>casein kinase (phosphorylating) activity</str><str>cytidine 3',5'-cyclic monophosphate-responsive protein kinase activity</str><str>dsk1</str><str>epsilon PKC</str><str>galactosyltransferase-associated kinase activity</str><str>glycogen synthase A kinase activity</str><str>glycogen synthase kinase 3 activity</str><str>glycogen synthase kinase activity</str><str>hydroxyalkyl-protein kinase activity</str><str>mitogen-activated S6 kinase activity</str><str>mitogen-activated protein kinase activity</str><str>non-specific serine/threonine protein kinase activity</str><str>p82 kinase activity</str><str>phosphorylase B kinase kinase activity</str><str>protein glutamyl kinase activity</str><str>protein kinase (phosphorylating) activity</str><str>protein kinase A activity</str><str>protein kinase p58 activity</str><str>protein phosphokinase activity</str><str>protein serine kinase activity</str><str>protein serine-threonine kinase activity</str><str>protein-aspartyl kinase activity</str><str>protein-cysteine kinase activity</str><str>protein-serine kinase activity</str><str>ribosomal S6 protein kinase activity</str><str>ribosomal protein S6 kinase II activity</str><str>serine kinase activity</str><str>serine protein kinase activity</str><str>serine(threonine) protein kinase activity</str><str>serine-specific protein kinase activity</str><str>serine/threonine protein kinase activity</str><str>threonine-specific protein kinase activity</str><str>twitchin kinase activity</str></arr><str name="id">GO:0004674</str></doc><doc><str name="go_definition">Catalysis of the reaction: protein serine phosphate + H2O = protein serine + phosphate, and protein threonine phosphate + H2O = protein threonine + phosphate.</str><str name="go_name">protein serine/threonine phosphatase activity</str><arr name="go_synonym"><str>3-hydroxy 3-methylglutaryl coenzymeA reductase phosphatase</str><str>Aspergillus awamori acid protein phosphatase</str><str>BCKDH phosphatase</str><str>GO:0000158</str><str>GO:0000163</str><str>GO:0008598</str><str>GO:0008600</str><str>GO:0015071</str><str>GO:0030357</str><str>GO:0030358</str><str>GO:0030360</str><str>GO:0030361</str><str>HMG-CoA reductase phosphatase</str><str>branched-chain alpha-keto acid dehydrogenase phosphatase</str><str>calcineurin</str><str>casein phosphatase</str><str>phosphatase 2A</str><str>phosphatase 2B</str><str>phosphatase C-II</str><str>phosphatase H-II</str><str>phosphatase I</str><str>phosphatase IB</str><str>phosphatase II</str><str>phosphatase III</str><str>phosphatase IV</str><str>phosphatase SP</str><str>phosphopyruvate dehydrogenase phosphatase</str><str>phosphospectrin phosphatase</str><str>polycation modulated (PCM-) phosphatase</str><str>protein D phosphatase</str><str>protein phosphatase X</str><str>protein phosphatase type 1 activity</str><str>protein phosphatase type 1, intrinsic catalyst activity</str><str>protein phosphatase type 2A activity</str><str>protein phosphatase type 2A, intrinsic catalyst activity</str><str>protein phosphatase type 2B activity</str><str>protein phosphatase type 2B, intrinsic catalyst activity</str><str>protein phosphatase type 2C activity</str><str>protein phosphatase type 4 activity</str><str>protein phosphatase type 4, intrinsic catalyst activity</str><str>serine/threonine specific protein phosphatase activity</str></arr><str name="id">GO:0004722</str></doc><doc><str name="go_definition">Catalysis of the reactions: protein threonine phosphate + H2O = protein threonine + phosphate; and protein tyrosine phosphate + H2O = protein tyrosine + phosphate.</str><str name="go_name">protein tyrosine/threonine phosphatase activity</str><str name="id">GO:0008330</str></doc></result>
</response></pre>
 
==transform==
 
edit: ~/package/apache-solr-3.5.0/example/solr/conf/xslt/solr2json.xsl solr2json.xsl
 
 
 
 
<pre><?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output media-type="application/json" encoding="UTF-8" method="text"/>
 
 
 
  <xsl:template match="/">
    <xsl:text>[</xsl:text>
        <xsl:for-each select="response/result/doc">
<xsl:if test="position()&gt;1">
<xsl:text>,</xsl:text>
</xsl:if>
<xsl:apply-templates select="."/>
</xsl:for-each>
    <xsl:text>]</xsl:text>
  </xsl:template>
 
  <xsl:template match="doc">
<xsl:text>{ "label":"</xsl:text>
<xsl:apply-templates select="str[@name='go_name']"/>
<xsl:text>", "value": "</xsl:text>
<xsl:apply-templates select="str[@name='id']"/>
<xsl:text>" }</xsl:text>
  </xsl:template>
 
  <xsl:template match="str">
<xsl:value-of select="translate(.,'&quot;','&quot;')"/>
  </xsl:template>
 
</xsl:stylesheet>
</pre>
 
http://localhost:8983/solr/select?q=go_definition:cancer&wt=xslt&tr=solr2json.xsl
 
[{ "label":"Z-phenylacetaldoxime metabolic process", "value": "GO:0018983" },{ "label":"epothilone metabolic process", "value": "GO:0050813" },{ "label":"epothilone biosynthetic process", "value": "GO:0050814" },{ "label":"aflatoxin biosynthetic process", "value": "GO:0045122" },{ "label":"aflatoxin metabolic process", "value": "GO:0046222" },{ "label":"aflatoxin catabolic process", "value": "GO:0046223" }]
 
==jquery==
 
install jquery and jquery ui in
 
/home/lindenb/package/apache-solr-3.5.0/example/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/
 
/home/lindenb/package/apache-solr-3.5.0/example/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/solr.html
 
 
<pre><html>
<head>
<link rel="stylesheet" type="text/css" href="jquery/development-bundle/themes/base/jquery.ui.all.css" />
<script type="text/javascript" src="jquery/js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="jquery/development-bundle/ui/jquery.ui.core.js"></script>
<script type="text/javascript" src="jquery/development-bundle/ui/jquery.ui.widget.js"></script>
<script type="text/javascript" src="jquery/development-bundle/ui/jquery.ui.position.js"></script>
<script type="text/javascript" src="jquery/development-bundle/ui/jquery.ui.autocomplete.js"></script>
<script  type="text/javascript">
 
$(function() {
$( "#go" ).autocomplete({
source: function( request, response )
{
$.ajax( {
dataType: "json",
url: "http://localhost:8983/solr/select",
data: {
q: "go_definition:"+request.term,
wt:"xslt",
tr:"solr2json.xsl",
},
success:  response
});
return false;
}
});
});
 
</script>
</head>
<body>
<form>
<div class="ui-widget">
<label for="go">Search Gene Ontology:</label><input id="go"/>
</div>
</form>
</body>
</html></pre>
[[Image:20120406.solr.jquery.png]]
 


<!-- ##### DO NOT edit below this line unless you know what you are doing. ##### -->
<!-- ##### DO NOT edit below this line unless you know what you are doing. ##### -->
|}
|}


__NOTOC__
__NOTOC__

Revision as of 06:08, 6 April 2012

Project name <html><img src="/images/9/94/Report.png" border="0" /></html> Main project page
<html><img src="/images/c/c3/Resultset_previous.png" border="0" /></html>Previous entry<html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</html>

Daily

Apache SOLR

tar xvfz apache-solr-3.5.0.tgz
rm apache-solr-3.5.0.tgz

Edit ./apache-solr-3.5.0/example/solr/conf/schema.xml

and add the following FIELDS:

  <field name="go_name" type="text_general" indexed="true" stored="true" multiValued="false"/>
  <field name="go_synonym" type="text_general" indexed="true" stored="true" multiValued="true"/>
  <field name="go_definition" type="text_general" indexed="true" stored="true" multiValued="false"/>

start solr:

   cd apache-solr-3.5.0/example/example
   java -jar start.jar


  $ xsltproc --novalid ~/go2solr.xsl ~/go_daily-termdb.rdf-xml.gz > ~/jeter.xml


<?xml version="1.0" encoding="UTF-8"?>
<add>
  <doc>
    <field name="id">GO:0000001</field>
    <field name="go_name" boost="2">mitochondrion inheritance</field>
    <field name="go_synonym">mitochondrial inheritance</field>
    <field name="go_definition">The distribution of mitochondria, including the mitochondrial genome, into daughter cells after mitosis or meiosis, medi
ated by interactions between mitochondria and the cytoskeleton.</field>
  </doc>
  <doc>
    <field name="id">GO:0000002</field>
    <field name="go_name" boost="2">mitochondrial genome maintenance</field>
    <field name="go_definition">The maintenance of the structure and integrity of the mitochondrial genome; includes replication and segregation of the 
mitochondrial chromosome.</field></doc></add>


index GO:

  ~/package/apache-solr-3.5.0/example/exampledocs$
   $ du -hs ~/package/apache-solr-3.5.0/
   136M	/home/lindenb/package/apache-solr-3.5.0/
   $ java -jar post.jar  ~/jeter.xml
SimplePostTool: version 1.4
SimplePostTool: POSTing files to http://localhost:8983/solr/update..
SimplePostTool: POSTing file jeter.xml
SimplePostTool: COMMITting Solr index changes..
  $ du -hs ~/package/apache-solr-3.5.0/
  153M	/home/lindenb/package/apache-solr-3.5.0/

==query http://localhost:8983/solr/select/?q=go_definition%3Acancer+go_name%3Agenome+-go_definition%3Ametabolism&version=2.2&start=0&rows=10&indent=on

<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader"><int name="status">0</int><int name="QTime">9</int><lst name="params"><str name="q">go_definition:protein</str></lst></lst><result name="response" numFound="3244" start="0"><doc><str name="go_definition">Catalysis of the reaction: octanoyl-[acyl-carrier protein] + protein = protein N6-(octanoyl)lysine + acyl-carrier protein.</str><str name="go_name">lipoyl(octanoyl) transferase activity</str><arr name="go_synonym"><str>LipB</str><str>lipoate/octanoate transferase activity</str><str>lipoyl (octanoyl)-acyl carrier protein:protein transferase activity</str><str>lipoyl (octanoyl)-acyl-carrier-protein-protein N-lipoyltransferase activity</str><str>octanoyl-acyl carrier protein-protein N-octanoyltransferase activity</str><str>octanoyl-acyl-carrier-protein-protein N-octanoyltransferase activity</str><str>octanoyl-acyl-carrier-protein:protein N-octanoyltransferase activity</str></arr><str name="id">GO:0033819</str></doc><doc><str name="go_definition">Catalysis of the reactions: protein serine + H2O = protein serine + phosphate; protein threonine phosphate + H2O = protein threonine + phosphate; and protein tyrosine phosphate + H2O = protein tyrosine + phosphate.</str><str name="go_name">protein tyrosine/serine/threonine phosphatase activity</str><arr name="go_synonym"><str>dual-specificity protein phosphatase</str></arr><str name="id">GO:0008138</str></doc><doc><str name="go_definition">A protein complex that possesses protein farnesyltransferase activity.</str><str name="go_name">protein farnesyltransferase complex</str><str name="id">GO:0005965</str></doc><doc><str name="go_definition">Catalysis of the reaction: palmitoyl-protein + H2O = palmitate + protein.</str><str name="go_name">palmitoyl-(protein) hydrolase activity</str><arr name="go_synonym"><str>palmitoyl-[protein] hydrolase</str><str>palmitoyl-protein hydrolase activity</str><str>palmitoyl-protein thioesterase activity</str><str>palmitoyl-protein thiolesterase activity</str></arr><str name="id">GO:0008474</str></doc><doc><str name="go_definition">Catalysis of the reaction: (protein)-L-serine = (protein)-D-serine.</str><str name="go_name">protein-serine epimerase activity</str><arr name="go_synonym"><str>protein-serine racemase activity</str></arr><str name="id">GO:0018365</str></doc><doc><str name="go_definition">A protein complex that possesses AMP-dependent protein kinase activity.</str><str name="go_name">AMP-activated protein kinase complex</str><arr name="go_synonym"><str>5'-AMP-activated protein kinase complex</str><str>Snf1 kinase complex</str><str>Snf1 serine/threonine protein kinase complex</str></arr><str name="id">GO:0031588</str></doc><doc><str name="go_definition">A protein complex that contains two G-protein coupled receptors.</str><str name="go_name">G-protein coupled receptor dimeric complex</str><arr name="go_synonym"><str>G-protein coupled receptor dimer</str><str>GPCR dimer</str></arr><str name="id">GO:0038037</str></doc><doc><str name="go_definition">Catalysis of the reactions: ATP + protein serine = ADP + protein serine phosphate, and ATP + protein threonine = ADP + protein threonine phosphate.</str><str name="go_name">protein serine/threonine kinase activity</str><arr name="go_synonym"><str>A-kinase activity</str><str>AP50 kinase activity</str><str>ATP-protein transphosphorylase activity</str><str>ATP:protein phosphotransferase (non-specific) activity</str><str>GO:0004695</str><str>GO:0004696</str><str>GO:0004700</str><str>HIPK2</str><str>Hpr kinase activity</str><str>M phase-specific cdc2 kinase activity</str><str>MAPK</str><str>PKA</str><str>PKC</str><str>Prp4 protein kinase activity</str><str>Raf kinase activity</str><str>Raf-1</str><str>STK32</str><str>T-antigen kinase activity</str><str>WEE1Hu</str><str>Wee 1-like kinase activity</str><str>Wee-kinase activity</str><str>atypical PKC activity</str><str>atypical protein kinase C activity</str><str>betaIIPKC</str><str>calcium/phospholipid-dependent protein kinase activity</str><str>casein kinase (phosphorylating) activity</str><str>cytidine 3',5'-cyclic monophosphate-responsive protein kinase activity</str><str>dsk1</str><str>epsilon PKC</str><str>galactosyltransferase-associated kinase activity</str><str>glycogen synthase A kinase activity</str><str>glycogen synthase kinase 3 activity</str><str>glycogen synthase kinase activity</str><str>hydroxyalkyl-protein kinase activity</str><str>mitogen-activated S6 kinase activity</str><str>mitogen-activated protein kinase activity</str><str>non-specific serine/threonine protein kinase activity</str><str>p82 kinase activity</str><str>phosphorylase B kinase kinase activity</str><str>protein glutamyl kinase activity</str><str>protein kinase (phosphorylating) activity</str><str>protein kinase A activity</str><str>protein kinase p58 activity</str><str>protein phosphokinase activity</str><str>protein serine kinase activity</str><str>protein serine-threonine kinase activity</str><str>protein-aspartyl kinase activity</str><str>protein-cysteine kinase activity</str><str>protein-serine kinase activity</str><str>ribosomal S6 protein kinase activity</str><str>ribosomal protein S6 kinase II activity</str><str>serine kinase activity</str><str>serine protein kinase activity</str><str>serine(threonine) protein kinase activity</str><str>serine-specific protein kinase activity</str><str>serine/threonine protein kinase activity</str><str>threonine-specific protein kinase activity</str><str>twitchin kinase activity</str></arr><str name="id">GO:0004674</str></doc><doc><str name="go_definition">Catalysis of the reaction: protein serine phosphate + H2O = protein serine + phosphate, and protein threonine phosphate + H2O = protein threonine + phosphate.</str><str name="go_name">protein serine/threonine phosphatase activity</str><arr name="go_synonym"><str>3-hydroxy 3-methylglutaryl coenzymeA reductase phosphatase</str><str>Aspergillus awamori acid protein phosphatase</str><str>BCKDH phosphatase</str><str>GO:0000158</str><str>GO:0000163</str><str>GO:0008598</str><str>GO:0008600</str><str>GO:0015071</str><str>GO:0030357</str><str>GO:0030358</str><str>GO:0030360</str><str>GO:0030361</str><str>HMG-CoA reductase phosphatase</str><str>branched-chain alpha-keto acid dehydrogenase phosphatase</str><str>calcineurin</str><str>casein phosphatase</str><str>phosphatase 2A</str><str>phosphatase 2B</str><str>phosphatase C-II</str><str>phosphatase H-II</str><str>phosphatase I</str><str>phosphatase IB</str><str>phosphatase II</str><str>phosphatase III</str><str>phosphatase IV</str><str>phosphatase SP</str><str>phosphopyruvate dehydrogenase phosphatase</str><str>phosphospectrin phosphatase</str><str>polycation modulated (PCM-) phosphatase</str><str>protein D phosphatase</str><str>protein phosphatase X</str><str>protein phosphatase type 1 activity</str><str>protein phosphatase type 1, intrinsic catalyst activity</str><str>protein phosphatase type 2A activity</str><str>protein phosphatase type 2A, intrinsic catalyst activity</str><str>protein phosphatase type 2B activity</str><str>protein phosphatase type 2B, intrinsic catalyst activity</str><str>protein phosphatase type 2C activity</str><str>protein phosphatase type 4 activity</str><str>protein phosphatase type 4, intrinsic catalyst activity</str><str>serine/threonine specific protein phosphatase activity</str></arr><str name="id">GO:0004722</str></doc><doc><str name="go_definition">Catalysis of the reactions: protein threonine phosphate + H2O = protein threonine + phosphate; and protein tyrosine phosphate + H2O = protein tyrosine + phosphate.</str><str name="go_name">protein tyrosine/threonine phosphatase activity</str><str name="id">GO:0008330</str></doc></result>
</response>

transform

edit: ~/package/apache-solr-3.5.0/example/solr/conf/xslt/solr2json.xsl solr2json.xsl



<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output media-type="application/json" encoding="UTF-8" method="text"/> 
  

  
  <xsl:template match="/">
    <xsl:text>[</xsl:text>
        <xsl:for-each select="response/result/doc">
		<xsl:if test="position()>1">
			<xsl:text>,</xsl:text>
		</xsl:if>
		<xsl:apply-templates select="."/>
	</xsl:for-each>
    <xsl:text>]</xsl:text>
  </xsl:template>
  
  <xsl:template match="doc">
	<xsl:text>{ "label":"</xsl:text>
	<xsl:apply-templates select="str[@name='go_name']"/>
	<xsl:text>", "value": "</xsl:text>
	<xsl:apply-templates select="str[@name='id']"/>
	<xsl:text>" }</xsl:text>
  </xsl:template>

  <xsl:template match="str">
	<xsl:value-of select="translate(.,'"','"')"/>
  </xsl:template>

</xsl:stylesheet>

http://localhost:8983/solr/select?q=go_definition:cancer&wt=xslt&tr=solr2json.xsl

[{ "label":"Z-phenylacetaldoxime metabolic process", "value": "GO:0018983" },{ "label":"epothilone metabolic process", "value": "GO:0050813" },{ "label":"epothilone biosynthetic process", "value": "GO:0050814" },{ "label":"aflatoxin biosynthetic process", "value": "GO:0045122" },{ "label":"aflatoxin metabolic process", "value": "GO:0046222" },{ "label":"aflatoxin catabolic process", "value": "GO:0046223" }]

jquery

install jquery and jquery ui in

/home/lindenb/package/apache-solr-3.5.0/example/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/
/home/lindenb/package/apache-solr-3.5.0/example/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/solr.html 


<html>
<head>
<link rel="stylesheet" type="text/css" href="jquery/development-bundle/themes/base/jquery.ui.all.css" />
<script type="text/javascript" src="jquery/js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="jquery/development-bundle/ui/jquery.ui.core.js"></script>
<script type="text/javascript" src="jquery/development-bundle/ui/jquery.ui.widget.js"></script>
<script type="text/javascript" src="jquery/development-bundle/ui/jquery.ui.position.js"></script>
<script type="text/javascript" src="jquery/development-bundle/ui/jquery.ui.autocomplete.js"></script>
<script  type="text/javascript">

$(function() {
		
		$( "#go" ).autocomplete({
			source: function( request, response )
				{
				
				$.ajax( {
					dataType: "json",
					url: "http://localhost:8983/solr/select",
					data: {
						q: "go_definition:"+request.term,
						wt:"xslt",
						tr:"solr2json.xsl",
						},
					success:  response
					});
				return false;
				}
		});
	});

</script>
</head>
<body>
<form>
<div class="ui-widget">
<label for="go">Search Gene Ontology:</label><input id="go"/>
</div>
</form>
</body>
</html>