Revision 312648dd

b/.classpath
2 2
<classpath>
3 3
	<classpathentry kind="src" path="src"/>
4 4
	<classpathentry kind="src" path="test"/>
5
	<classpathentry kind="src" path="solr/src"/>
5 6
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
6 7
	<classpathentry kind="lib" path="ear/lib/commons-lang.jar">
7 8
		<attributes>
......
183 184
	<classpathentry kind="lib" path="dependencies/gwt-gears-1.3.0/gwt-gears.jar"/>
184 185
	<classpathentry kind="lib" path="dependencies/gwt-visualization-1.1.0/gwt-visualization.jar"/>
185 186
	<classpathentry kind="lib" path="dependencies/apache-solr-1.4.1/dist/apache-solr-solrj-1.4.1.jar"/>
187
	<classpathentry kind="lib" path="dependencies/apache-solr-1.4.1/lib/lucene-analyzers-2.9.3.jar"/>
188
	<classpathentry kind="lib" path="dependencies/apache-solr-1.4.1/lib/lucene-core-2.9.3.jar"/>
189
	<classpathentry kind="lib" path="dependencies/apache-solr-1.4.1/dist/apache-solr-core-1.4.1.jar"/>
186 190
	<classpathentry kind="output" path="bin"/>
187 191
</classpath>
b/build.xml
146 146
        <get src="${hornetq.download.url}" dest="${deps.dir}/${hornetq.filename}" usetimestamp="true"/>
147 147
        <get src="${junit.download.url}" dest="${deps.dir}/${junit.filename}" usetimestamp="true"/>
148 148
        <get src="${jboss.download.url}" dest="${deps.dir}/${jboss.filename}" usetimestamp="true"/>
149
    	<get src="${solr.download.url}" dest="${deps.dir}/${solr.filename}" usetimestamp="true"/>
150 149
    	<unzip src="${deps.dir}/${gwt.filename}" dest="${deps.dir}"/>
151 150
        <unzip src="${deps.dir}/${gwt-gears.filename}" dest="${deps.dir}"/>
152 151
        <unzip src="${deps.dir}/${gwt-visualization.filename}" dest="${deps.dir}"/>
153 152
        <unzip src="${deps.dir}/${hornetq.filename}" dest="${deps.dir}"/>
154 153
        <unzip src="${deps.dir}/${junit.filename}" dest="${deps.dir}"/>
155 154
        <unzip src="${deps.dir}/${jboss.filename}" dest="${jboss.home}/.."/>
156
    	<unzip src="${deps.dir}/${solr.filename}" dest="${deps.dir}"/>
157 155
    </target>
158 156

  
159
	<target name="install" depends="fetch-dependencies" description="Installs the configuration files of the application server">
157
	<target name="install" depends="fetch-dependencies, install-solr" description="Installs the configuration files of the application server">
160 158
		<!-- Install HornetQ configuration -->
161 159
		<copy todir="${jboss.run_conf.lib.dir}">
162 160
			<fileset dir="${hornetq.path}/lib">
......
202 200
		</copy>
203 201
        <!-- Make run.sh executable again -->
204 202
        <chmod file="${jboss.bin.dir}/run.sh" perm="ugo+x"/>
205
		
206
		<copy todir="${solr.conf.dir}" overwrite="true" failonerror="false">
207
			<fileset dir="${solr-spec.conf.dir}" />
208
		</copy>
209 203
	</target>
210 204

  
211 205
	<target name="compile" description="Compile src to bin">
......
444 438
            <arg line="${jboss.args}"/>
445 439
		</exec>
446 440
    </target>
441
    
442
	<target name="check-solr">
443
		<available file="${solr.root}" type="dir" property="solr.home.present"/>
444
	</target>
445

  
446
    <target name="fetch-solr" unless="solr.home.present" depends="check-solr">
447
		<get src="${solr.download.url}" dest="${deps.dir}/${solr.filename}" usetimestamp="true"/>
448
    	<unzip src="${deps.dir}/${solr.filename}" dest="${deps.dir}"/>
449
    </target>
450
    
451
    <target name="install-solr" depends="fetch-solr">
452
		<copy todir="${solr.conf.dir}" overwrite="true" failonerror="false">
453
			<fileset dir="${solr-spec.conf.dir}" />
454
		</copy>
455
		<jar destfile="${solr.root}/greektokenfilter.jar">
456
		    <fileset dir="${build.dir}">
457
				<include name="gr/ebs/gss/solr/analysis/GreekLowerCaseFilterFactory.class"/>
458
		    </fileset>
459
		</jar>
460
    </target>
461
    
462
    <target name="run-solr" depends="install-solr">
463
        <java jar="${solr.root}/example/start.jar" fork="true" dir="${solr.root}/example"/>
464
    </target>
447 465
</project>
b/solr/conf/schema.xml
233 233
                />
234 234
        <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="1" splitOnCaseChange="1"/>
235 235
        <filter class="solr.LowerCaseFilterFactory"/>
236
        <filter class="gr.ebs.gss.solr.analysis.GreekLowerCaseFilterFactory"/>
236 237
        <filter class="solr.SnowballPorterFilterFactory" language="English" protected="protwords.txt"/>
237 238
      </analyzer>
238 239
      <analyzer type="query">
......
245 246
                />
246 247
        <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
247 248
        <filter class="solr.LowerCaseFilterFactory"/>
249
        <filter class="gr.ebs.gss.solr.analysis.GreekLowerCaseFilterFactory"/>
248 250
        <filter class="solr.SnowballPorterFilterFactory" language="English" protected="protwords.txt"/>
249 251
      </analyzer>
250 252
    </fieldType>
......
426 428
   -->
427 429

  
428 430
   <field name="id" type="string" indexed="true" stored="true" required="true" /> 
429
   <field name="name" type="text_greek" indexed="true" stored="true" required="true"/>
430
   <field name="tag" type="text_greek" indexed="true" stored="true" multiValued="true"/>
431
   <field name="name" type="text" indexed="true" stored="true" required="true"/>
432
   <field name="tag" type="text" indexed="true" stored="true" multiValued="true"/>
431 433
<!--   <field name="sku" type="textTight" indexed="true" stored="true" omitNorms="true"/>
432 434
   <field name="name" type="textgen" indexed="true" stored="true"/>
433 435
   <field name="alphaNameSort" type="alphaOnlySort" indexed="true" stored="false"/>
......
461 463

  
462 464
   <!-- catchall field, containing all other searchable text fields (implemented
463 465
        via copyField further on in this schema  -->
464
   <field name="text" type="text_greek" indexed="true" stored="false" multiValued="true"/>
466
   <field name="text" type="text" indexed="true" stored="false" multiValued="true"/>
465 467

  
466 468
   <!-- catchall text field that indexes tokens both normally and in reverse for efficient
467 469
        leading wildcard queries. -->
b/solr/conf/solrconfig.xml
61 61
  <lib dir="/total/crap/dir/ignored" /> 
62 62
  <!-- an exact path can be used to specify a specific file.  This will cause
63 63
       a serious error to be logged if it can't be loaded.
64
  <lib path="../a-jar-that-does-not-exist.jar" /> 
65 64
  -->
65
  <lib path="../../greektokenfilter.jar" /> 
66 66

  
67 67
  
68 68
  <!-- Used to specify an alternate directory to hold all index data
b/solr/src/gr/ebs/gss/solr/analysis/GreekLowerCaseFilterFactory.java
1
/*
2
 * Copyright 2010 Electronic Business Systems Ltd.
3
 *
4
 * This file is part of GSS.
5
 *
6
 * GSS is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * GSS is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with GSS.  If not, see <http://www.gnu.org/licenses/>.
18
 */
19
package gr.ebs.gss.solr.analysis;
20

  
21
import org.apache.lucene.analysis.TokenStream;
22
import org.apache.lucene.analysis.el.GreekLowerCaseFilter;
23
import org.apache.solr.analysis.BaseTokenFilterFactory;
24

  
25
/**
26
 * @author chstath
27
 *
28
 */
29
public class GreekLowerCaseFilterFactory extends BaseTokenFilterFactory {
30
	
31
	/**
32
	 * 
33
	 */
34
	public GreekLowerCaseFilter create(TokenStream input) {
35
		return new GreekLowerCaseFilter(input);
36
	}
37
}
b/src/gr/ebs/gss/server/ejb/ExternalAPI.java
1104 1104
	public void rebuildSolrIndex();
1105 1105

  
1106 1106
	/**
1107
	 * It is used by the Solr mbean to refresh the index. It does not delete anything just re-add everything in the index
1108
	 */
1109
	public void refreshSolrIndex();
1110
	
1111
	/**
1107 1112
	 * Creates a new file with the specified owner, parent folder and name. The
1108 1113
	 * new file has the same permissions as its parent folder. The file contents
1109 1114
	 * are already uploaded outside of externalAPI and the uploaded file is used as a parameter.
b/src/gr/ebs/gss/server/ejb/ExternalAPIBean.java
2087 2087
	}
2088 2088

  
2089 2089
	@Override
2090
	public void refreshSolrIndex() {
2091
		try {
2092
			CommonsHttpSolrServer solr = new CommonsHttpSolrServer(getConfiguration().getString("solr.url"));
2093
			
2094
			List<Long> fileIds = dao.getAllFileIds();
2095
			for (Long id : fileIds) {
2096
				postFileToSolr(id);
2097
			}
2098
			solr.optimize();
2099
			solr.commit();
2100
		} catch (IOException e) {
2101
			throw new EJBException(e);
2102
		} catch (SolrServerException e) {
2103
			throw new EJBException(e);
2104
		}
2105
	}
2106

  
2107
	@Override
2090 2108
	public FileHeaderDTO createFile(Long userId, Long folderId, String name, String mimeType, long fileSize, String filePath)
2091 2109
			throws DuplicateNameException, ObjectNotFoundException, GSSIOException,
2092 2110
			InsufficientPermissionsException, QuotaExceededException {

Also available in: Unified diff