@@ -0,0 +1,2793 @@
+package de.tblsoft.solr.pipeline.filter.nlp;%0A%0A%0Aimport com.quasiris.qsf.commons.text.TextUtils;%0Aimport de.tblsoft.solr.pipeline.AbstractFilter;%0Aimport de.tblsoft.solr.pipeline.bean.Document;%0Aimport de.tblsoft.solr.util.DatatypeUtils;%0A%0A/**%0A * Analyze search query an append meta information%0A *%0A */%0Apublic class SearchQueryAnalyzerFilter extends AbstractFilter %7B%0A%0A%0A%0A    private String fieldName;%0A%0A%0A    @Override%0A    public void init() %7B%0A        fieldName = getProperty(%22fieldName%22, %22keyword%22);%0A        verify(fieldName, %22For the AddStaticValueFilter a fieldName must be defined.%22);%0A        super.init();%0A    %7D%0A%0A%0A    @Override%0A    public void document(Document document) %7B%0A%0A        String value = document.getFieldValue(fieldName);%0A        analyzeSearchQuery(value, document);%0A        super.document(document);%0A    %7D%0A%0A    private void analyzeSearchQuery(String searchQuery, Document document) %7B%0A        if(searchQuery == null) %7B%0A            return;%0A        %7D%0A        document.setField(%22charCount%22 , searchQuery.length());%0A%0A        int tokenCount = searchQuery.split(%22 %22).length;%0A        document.setField(%22tokenCount%22 , tokenCount);%0A%0A        String countAsString = document.getFieldValue(%22count%22);%0A        if(countAsString != null) %7B%0A            int count = Integer.valueOf(countAsString);%0A            int normalizedCount = tokenCount * count;%0A            document.setField(%22normalizedCount%22 , normalizedCount);%0A        %7D%0A%0A%0A%0A        tagToken(searchQuery, %22query%22, document);%0A        for(String token : searchQuery.split(%22 %22)) %7B%0A            tagToken(token, %22token%22, document);%0A        %7D%0A%0A%0A%0A%0A    %7D%0A%0A    private void tagToken(String token, String prefix, Document document) %7B%0A%0A        if(TextUtils.containsNumber(token)) %7B%0A            document.addField(%22tag%22, prefix + %22containsNumber%22);%0A        %7D%0A%0A        if(DatatypeUtils.isBoolean(token)) %7B%0A            document.addField(%22tag%22, prefix + %22boolean%22);%0A        %7D%0A%0A        if(DatatypeUtils.isNumber(token)) %7B%0A            document.addField(%22tag%22, prefix + %22number%22);%0A            document.addField(%22tagdetail%22, prefix + %22number%22 + token.length());%0A        %7D%0A        if(DatatypeUtils.isInteger(token)) %7B%0A            document.addField(%22tag%22, prefix + %22integer%22);%0A            document.addField(%22tagdetail%22, prefix + %22integer%22 + token.length());%0A        %7D%0A        if(DatatypeUtils.isLong(token)) %7B%0A            document.addField(%22tag%22, prefix + %22long%22);%0A            document.addField(%22tagdetail%22, prefix + %22long%22 + token.length());%0A        %7D%0A%0A        if(isWord(token)) %7B%0A            document.addField(%22tag%22, prefix + %22word%22);%0A        %7D%0A%0A    %7D%0A%0A    private boolean isWord(String value) %7B%0A        for(char c : value.toCharArray()) %7B%0A            if(!Character.isLetter(c)) %7B%0A                return false;%0A            %7D%0A        %7D%0A        return true;%0A    %7D%0A%0A%0A%0A%7D%0A%0A

implement a SearchQueryAnalyzerFilter