Now am doing analyzing on solr 4.1 version .In which,new Feature "SOLR-4271: Add support for PostingsHighlighter." has been given.
From the following link, http://lucene.apache.org/solr/4_1_0/solr-core/org/apache/solr/highlight/PostingsSolrHighlighter.html I found how to configure PostingHighlighter.
So I configured my PostingHighLighter as follows,
< searchComponent class="solr.HighlightComponent" name="highlight">
< highlighting class="org.apache.solr.highlight.PostingsSolrHighlighter"
preTag="<em_testing>"
postTag="</em_testing>"
ellipsis="... "
/>
< /searchComponent>
I used the following query to test highlighter;
solr/collection1/query?q=electronics&shard.keys=customerB!&wt=xml&hl=true&hl.fl=cat
But my result was, following one
< lst name="highlighting">
< lst name="F8V7067-APL-KIT">
< arr name="cat">
< str>
< em>electronics< /em>
< /str>
< /arr>
The expected result is < em_testing> instead of < em>.
So Whats wrong with my configuration or what is the actual use of PostingSolrHighlighter.
Related
<
#randomly shifts whatever I type down here
I'm supposed to type
But it ends up looking like
<
div > < /div>
I guess it is vs code setting for auto close tags.
try to disable it and check if it is fixed or not.
Go to File > Preference > Setting ( Ctrl + , ) Extension > HTML. And remove tick from the "Auto Closing Tags".
I am working on ECG signal processing As I need to collect all the data from MATLAB to use it as test signal, I am finding it difficult to read the annotations files which extention is .atr .
I am using MIT Arrhythmia database.
How can I read the annotation files?
I tried this
[ann,type,subtype,chan,num,comments] = rdann('102','atr');
but I am not sure the length of the ann I get is correct.
Based on the implementation given here
Here is a code snippet to read an annotation file.
PATH= 'PATH TO DIRECTORY'; % path, where data are saved
ATRFILE= '100.atr'; % attributes-file in binary format
atrd= fullfile(PATH, ATRFILE); % attribute file with annotation data
fid3=fopen(atrd,'r');
A= fread(fid3, [2, inf], 'uint8')';
sfreq=A(2);
fclose(fid3);
SAMPLES2READ=1;
ATRTIME=[];
ANNOT=[];
TIME=(0:(SAMPLES2READ-1))/sfreq;
sa=size(A);
saa=sa(1);
i=1;
while i<=saa
annoth=bitshift(A(i,2),-2);
if annoth==59
ANNOT=[ANNOT;bitshift(A(i+3,2),-2)];
ATRTIME=[ATRTIME;A(i+2,1)+bitshift(A(i+2,2),8)+...
bitshift(A(i+1,1),16)+bitshift(A(i+1,2),24)];
i=i+3;
elseif annoth==60
% nothing to do!
elseif annoth==61
% nothing to do!
elseif annoth==62
% nothing to do!
elseif annoth==63
hilfe=bitshift(bitand(A(i,2),3),8)+A(i,1);
hilfe=hilfe+mod(hilfe,2);
i=i+hilfe/2;
else
ATRTIME=[ATRTIME;bitshift(bitand(A(i,2),3),8)+A(i,1)];
ANNOT=[ANNOT;bitshift(A(i,2),-2)];
end;
i=i+1;
end;
ANNOT(length(ANNOT))=[]; % last line = EOF (=0)
ATRTIME(length(ATRTIME))=[]; % last line = EOF
clear A;
ATRTIME= (cumsum(ATRTIME))/sfreq;
ind= find(ATRTIME <= TIME(end));
ATRTIMED= ATRTIME(ind);
ANNOT=round(ANNOT);
ANNOT is an array with all the annotations
Starting to work with Haxe compiling to a Flash swc file,
it is advised not to use the Array 'insert' in loops or if statements.
I have this code, which requires using loops and if statements
if (coa[8] > 0){
for (ip in 0...s1.length){
if (s1[ip] == "*"){if (s1[ip-2] <= 0 || s1[ip-2] > 0){if (s1[ip-1] <= 0 || s1[ip-1] > 0){
var t1 = ip-2;var t2 = (ip-2)*(ip-1);
s1.insert(t1,t2);s1.splice(ip-2,3);
coa[8]--;
}}};
} // loop ip
}
The swc file compiles without error but when I plug it into the Flash CC (2014) IDE and test I get the following error
Error #1006: insert is not a function.
at Haxe2D/execute()
The arrays are dynamic which could be why the swc compiles without registering an error.
Is there a solution to this?
It sounds like you didn't call haxe.initSwc(mc); before running your code.
It is required as stated at http://old.haxe.org/manual/swc.
I have a directory with several sub-directories in it. Inside there are files. Out of those file1.ext is a duplicate present in more than 1 directory. The sub-directories and filenames are obviously unknown at the time of execution.
-> bigdir
--------> subdir1
----------------> file1.ext
--------> subdir2
----------------> file1.ext
--------> subdir3
----------------> file2.ext
I am trying to copy contents of bigdir into smalldir using flatten="true" so that my resultant file structure looks like
-> smalldir
----------> file1.ext
----------> file2.ext
So far, I have the following
<copy todir="${smalldir}" flatten="true" verbose="true">
<fileset dir="${bigdir}">
<include name="**/*.ext"/>
</fileset>
</copy>
This works fine and achieves the result that I want, HOWEVER, it is an error to have duplicate files in bigdir. I want the build to fail if it detects that bigdir has duplicate filenames inside
I was trying to find a way to make the <copy> task fail in such case. It doesn't have to be through this approach. I can happily run some kind of validation on the directory before copying too, if I could figure out how.
Maybe make each copied file read-only, so that subsequent overwrites as a result of copy flatten=true fail to overwrite and produce an error?
No ant-contrib please
You may use a scriptcondition (see ant manual conditions) with builtin javascript engine
(included since Java 1.6.06, so no extra libraries or ant addons needed), like that :
<project>
<fileset dir="C:\tmp\bigdir" id="whatever"/>
<echo>${toString:whatever}</echo>
<fail message="Duplicate Filenames detected !!">
<condition>
<scriptcondition language="javascript">
<![CDATA[
importPackage(java.util);
var input = project.getProperty('toString:whatever').split(';');
// get basenames
for (var i = 0; i < input.length; i++) {
input[i]=input[i].substring(input[i].lastIndexOf("\\")+1);
}
var inputList = Arrays.asList(input);
// no duplicates in Hashset
var inputSet = new HashSet(inputList);
self.setValue(inputSet.size() < inputList.size());
]]>
</scriptcondition>
</condition>
</fail>
</project>
output :
[echo] subdir1\foo.txt;subdir2\foo.txt;subdir3\foobar.txt
BUILD FAILED
C:\area51\AntTest\tryme.xml:7: Duplicate Filenames detected !!
-- EDIT after comment --
To display the duplicates use something like :
<project>
<fileset dir="C:\bigdir" id="whatever"/>
<echo>${toString:whatever}</echo>
<fail message="Duplicate Filenames detected !!">
<condition>
<scriptcondition language="javascript">
<![CDATA[
importPackage(java.util);
// get DirectoryScanner
ds = whatever.getDirectoryScanner(project);
// get the included files => array
checkFiles = ds.getIncludedFiles();
var checkSet = new HashSet();
var s = "";
for (j=0; j < checkFiles.length; j++) {
f = new java.io.File(whatever.getDir(project), checkFiles[j]);
if(!checkSet.add(f.getName()))
s += f + '\n';
}
println(s.substring(0, s.length - 1));
self.setValue(checkSet.size() < checkFiles.length);
]]>
</scriptcondition>
</condition>
</fail>
</project>
output :
[echo] subdir1\foo.txt;subdir2\foo.txt;subdir3\foobar.txt;subdir3\subsubdir1\foo.txt;subdir3\subsubdir2\foobar.txt;subdir4\foobaz.txt
[fail] C:\bigdir\subdir2\foo.txt
[fail] C:\bigdir\subdir3\subsubdir1\foo.txt
[fail] C:\bigdir\subdir3\subsubdir2\foobar.txt
BUILD FAILED
Btw, often it's much simpler to use the ant api :
// get DirectoryScanner
ds = whatever.getDirectoryScanner(project);
// get the included files => array
checkFiles = ds.getIncludedFiles();
instead of :
var input = project.getProperty('toString:whatever').split(';');
// get basenames
for (var i = 0; i < input.length; i++) {
input[i]=input[i].substring(input[i].lastIndexOf("\\")+1);
}
as i used in first snippet.
Running Solr on Tomcat 7 on Win 2008 Server.
I am looping through a number of variables and creating a set of range queries to create a query containing more than 500 clauses.
List<ISolrQuery> queryList = new List<ISolrQuery>();
//THis is for var 1 , I have 6 sets of vars like this...
for (int n = 0; n < N; n++)
{
queryList.Add(new SolrQueryByRange<double>("VAR1_" + n, val1[n] * lowerbound, val1[n] * upperBound));
}
//...var 2
for (int n = 0; n < N; n++)
{
queryList.Add(new SolrQueryByRange<double>("VAR2_" + n, val2[n] * lowerbound, val2[n] * upperBound));
}
//...var 3... and so on...
var results = solr.Query(new SolrMultipleCriteriaQuery(queryList.ToArray<ISolrQuery>(),"OR"), new QueryOptions
{
Rows = 100,
Fields = new[] { "FileName, ID,score" },
Facet = new FacetParameters
{
Queries = new[]
{
new SolrFacetFieldQuery("Extension"),
new SolrFacetFieldQuery("FileName"),
}
}
});
I am getting a 400 bad request back from solr. The query works fine, when I run just 1 var. I am assuming this is some bool query limitation in solr. I did set the maxBoolClauseCount (from 1024) to 9999. BUt the error persists.
Any ideas?
Could it be because it is running into default GET para meter size limit of jetty?
Please refer to this answer Solr search query returning full head exception .