commit 1e6d072bb38b924a317c378ba55359dec0286dc2
Author: jpoubova <jpoubova@students.zcu.cz>
Date:   Wed May 13 16:59:00 2020 +0200

    Re #8031: Programová příručka BE
    - dopsání komentářů
    - smazání nepotřebného kódu
    - vylepšené členění do tříd a metod

diff --git a/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/FulltextSearchApplication.java b/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/FulltextSearchApplication.java
index 6d33ba3..f368735 100644
--- a/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/FulltextSearchApplication.java
+++ b/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/FulltextSearchApplication.java
@@ -11,7 +11,6 @@ public class FulltextSearchApplication {
 	private static final Logger LOG = LoggerFactory.getLogger(FulltextSearchApplication.class);
 
 	public static void main(String[] args) {
-
 		LOG.info("Starting Spring BE");
 		SpringApplication.run(FulltextSearchApplication.class, args);
 	}
diff --git a/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/IndexController.java b/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/IndexController.java
index 82aac2b..10f34f7 100644
--- a/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/IndexController.java
+++ b/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/IndexController.java
@@ -1,6 +1,7 @@
 package cz.zcu.kiv.aswi.fulltextsearch;
 
 import cz.zcu.kiv.aswi.fulltextsearch.model.*;
+import org.apache.solr.client.solrj.SolrServerException;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
@@ -8,6 +9,9 @@ import org.springframework.web.multipart.MultipartFile;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.xml.bind.JAXBException;
+import javax.xml.stream.XMLStreamException;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -17,19 +21,26 @@ import java.util.List;
 public class IndexController {
 
     private static final Logger LOG = LoggerFactory.getLogger(IndexController.class);
+
     private SolrService solrService = new SolrService();
 
     @PostMapping("/")
-    public SearchResponse index(@RequestBody SearchRequest searchRequest) {
-        LOG.trace("Method index called");
+    public SearchResponse search(@RequestBody SearchRequest searchRequest) {
         try {
-            LOG.debug("Calling SolrService and its Query method");
-            return solrService.query(searchRequest);
+            LOG.trace("Method search called");
+
+            LOG.debug("Calling SolrService and its search method");
+            return solrService.search(searchRequest);
+        } catch (SolrServerException e) {
+            LOG.error("SolrServerException: " + e.toString());
+        } catch (IOException e) {
+            LOG.error("IOException: " + e.toString());
         } catch (Exception e) {
-            LOG.error("Cannot get method Query from SolrService returning NULL");
-            LOG.error(e.toString());
-            return null;
+            LOG.error("Unknown exception: " + e.toString());
         }
+
+        LOG.error("Cannot get method search from SolrService returning NULL");
+        return null;
     }
 
     @PostMapping("/upload")
@@ -41,12 +52,25 @@ public class IndexController {
             int uploaded = solrService.uploadFiles(files);
             message = "Successfully uploaded " + uploaded + " files";
             return ResponseEntity.status(HttpStatus.OK).body(new ResponseMessage(message));
+        } catch (IOException e) {
+            LOG.error("IOException: " + e.toString());
+            message = "Could not upload the files! " + e.toString();
+        } catch (SolrServerException e) {
+            LOG.error("SolrServerException: " + e.toString());
+            message = "Could not upload the files! " + e.toString();
+        } catch (XMLStreamException e) {
+            LOG.error("XMLStreamException: " + e.toString());
+            message = "Could not upload the files! " + e.toString();
+        } catch (JAXBException e) {
+            LOG.error("JAXBException: " + e.toString());
+            message = "Could not upload the files! " + e.toString();
         } catch (Exception e) {
-            LOG.error("Cannot get method uploadFiles from SolrService");
-            LOG.error(e.toString());
+            LOG.error("Unknown exception: " + e.toString());
             message = "Could not upload the files! " + e.toString();
-            return ResponseEntity.status(HttpStatus.EXPECTATION_FAILED).body(new ResponseMessage(message));
         }
+
+        LOG.error("Cannot get method uploadFiles from SolrService");
+        return ResponseEntity.status(HttpStatus.EXPECTATION_FAILED).body(new ResponseMessage(message));
     }
 
     @GetMapping("/documents")
@@ -57,14 +81,21 @@ public class IndexController {
         try {
             LOG.debug("Calling SolrService and its listAllFiles method");
             List<String> filenames = solrService.listAllFiles();
-            int id = 0; // todo
+            int id = 0;
             for (String filename: filenames) {
-                response.add(new DocumentResponse(filename, id++, new Date(), new Date()));
+                response.add(new DocumentResponse(filename, id++, new Date()));
             }
+
+            return response;
+        } catch (SolrServerException e) {
+            LOG.error("SolrServerException: " + e.toString());
+        } catch (IOException e) {
+            LOG.error("IOException: " + e.toString());
         } catch (Exception e) {
-            LOG.error("Cannot get method listAllFiles from SolrService");
-            LOG.error(e.toString());
+            LOG.error("Unknown exception: " + e.toString());
         }
+
+        LOG.error("Cannot get method listAllFiles from SolrService");
         return response;
     }
 
@@ -76,44 +107,17 @@ public class IndexController {
         try {
             LOG.debug("Calling SolrService and its listSingleFile method");
             ret = solrService.listSingleFile(documentName);
+            return new DocumentDetailResponse(ret);
+        } catch (SolrServerException e) {
+            LOG.error("SolrServerException: " + e.toString());
+        } catch (IOException e) {
+            LOG.error("IOException: " + e.toString());
         } catch (Exception e) {
-            LOG.error("Cannot get method listSingleFile from SolrService");
-            LOG.error(e.toString());
+            LOG.error("Unknown exception: " + e.toString());
         }
-        return new DocumentDetailResponse(ret);
-    }
 
-    @GetMapping("/delete")
-    public String delete() {
-        LOG.trace("Method delete called");
-        String response;
-
-        try {
-            LOG.debug("Calling SolrService and its deleteAll method");
-            solrService.deleteAll();
-            response = "All documents have been deleted.";
-        } catch (Exception e) {
-            LOG.error("Cannot get method deleteAll from SolrService");
-            LOG.error(e.toString());
-            response = "Unknown exception";
-        }
-        return response;
+        return new DocumentDetailResponse(ret);
     }
 
-    @GetMapping("/info")
-    public String info() {
-        LOG.trace("Method info called");
-        String response;
-
-        try {
-            LOG.debug("Calling SolrService and its info method");
-            response = solrService.info();
-        } catch (Exception e) {
-            LOG.error("Cannot get method info from SolrService");
-            LOG.error(e.toString());
-            response = "Unknown exception";
-        }
-        return response;
-    }
 }
 
diff --git a/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/SolrService.java b/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/SolrService.java
index bfae5aa..f4911a6 100644
--- a/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/SolrService.java
+++ b/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/SolrService.java
@@ -22,6 +22,7 @@ import org.springframework.web.multipart.MultipartFile;
 
 import javax.imageio.ImageIO;
 import javax.xml.bind.JAXBException;
+import javax.xml.stream.XMLStreamException;
 import java.awt.image.BufferedImage;
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
@@ -30,11 +31,9 @@ import java.util.stream.Collectors;
 
 public class SolrService {
 
-    // for docker
-    private static final String URL = "http://fulltextsearch-solr";
+    private static final Logger LOG = LoggerFactory.getLogger(SolrService.class);
 
-    // for localhost
-    //private static final String URL = "http://localhost";
+    private static final String URL = "http://fulltextsearch-solr";
 
     private static final String CORE_NAME_DOCUMENTS = "documents";
     private static final String CORE_NAME_FILES = "files";
@@ -49,10 +48,9 @@ public class SolrService {
     private static final String FIELD_TEXT_REGION_COORDS = "text_region" + SUFFIX_COORDS;
     private static final String FIELD_DOC_CONTENT = "doc_content";
     private static final String FIELD_IMG_CONTENT = "img_content";
-    private static final float IMG_OUTPUT_QUALITY = 0.5f;
-    private static final Logger LOG = LoggerFactory.getLogger(SolrService.class);
+    private static final String FIELD_UPLOADED_DATE = "uploadedDate";
 
-    private static final int SEARCH_QUERY_ROWS = 100;
+    private static final float IMG_OUTPUT_QUALITY = 0.5f;
 
     private static final int DEFAULT_LINE_FIELD_COUNT = 150;
     private static final int DEFAULT_WORD_FIELD_COUNT = 30;
@@ -63,40 +61,37 @@ public class SolrService {
     private HttpSolrClient solrClientFiles;
     private List<String> fieldNamesDocumentCore = new ArrayList<>();
 
+    /**
+     * Creates SolrService - connects to Solr.
+     */
     public SolrService() {
         connect();
     }
 
+    /**
+     * Connects to Solr - to both cores documents and files.
+     * If such cores do not exists, it creates them.
+     */
     private void connect() {
-        LOG.info("Waiting for solr => 10 seconds");
+        LOG.info("Waiting for Solr => 10 seconds");
         try {
             Thread.sleep(10000);
         } catch (InterruptedException e) {
-            LOG.error("Cannot sleep thread", e);
+            LOG.error("Cannot sleep thread, not waiting for Solr!", e);
         }
 
         LOG.info("Connecting to Solr...");
         String urlString = URL + ":8983/solr/";
 
         try {
-            // documents
+            // core documents
             solrClientDocuments = new HttpSolrClient.Builder(urlString).build();
-            if (CoreAdminRequest.getStatus(CORE_NAME_DOCUMENTS, solrClientDocuments).getCoreStatus(CORE_NAME_DOCUMENTS).size() < 1) {
-                CoreAdminRequest.createCore(CORE_NAME_DOCUMENTS, CORE_NAME_DOCUMENTS, solrClientDocuments, "conf/solrconfig.xml", "documents-schema.xml");
-                LOG.info("Core " + CORE_NAME_DOCUMENTS + " has been created.");
-            } else {
-                LOG.info("Core " + CORE_NAME_DOCUMENTS + " already exists.");
-            }
+            createCore(solrClientDocuments, "documents-schema.xml");
             solrClientDocuments.setBaseURL(solrClientDocuments.getBaseURL() + "/" +  CORE_NAME_DOCUMENTS);
 
-            // files
+            // core files
             solrClientFiles = new HttpSolrClient.Builder(urlString).build();
-            if (CoreAdminRequest.getStatus(CORE_NAME_FILES, solrClientFiles).getCoreStatus(CORE_NAME_FILES).size() < 1) {
-                CoreAdminRequest.createCore(CORE_NAME_FILES, CORE_NAME_FILES, solrClientFiles, "conf/solrconfig.xml", "files-schema.xml");
-                LOG.info("Core " + CORE_NAME_FILES + " has been created.");
-            } else {
-                LOG.info("Core " + CORE_NAME_FILES + " already exists.");
-            }
+            createCore(solrClientFiles, "files-schema.xml");
             solrClientFiles.setBaseURL(solrClientFiles.getBaseURL() + "/"  + CORE_NAME_FILES);
 
             LOG.info("Connected to Solr.");
@@ -105,53 +100,59 @@ public class SolrService {
         }
     }
 
-    public int uploadFiles(List<MultipartFile> files) throws IOException, SolrServerException, JAXBException {
-        LOG.trace("SolrService method uploadFiles called");
-        Map<String, List<MultipartFile>> pairs = new HashMap<>();
-
-        LOG.debug("Preprocessing files for upload to Solr");
-        for (MultipartFile file: files) {
-            String filename = file.getOriginalFilename();
-            if (filename == null) {
-                LOG.error("Skipping file with empty filename");
-                continue;
-            }
-
-            String type = file.getContentType();
-            if (type == null) {
-                LOG.error("Skipping file " + filename + " (unknown type)");
-                continue;
-            }
-
-            int index = filename.lastIndexOf('.');
-            String filenameWithoutExtension = filename;
-            if (index >= 0) {
-                filenameWithoutExtension = filename.substring(0, index);
-            }
+    /**
+     * Creates core corresponding with given client only if this core doesn't already exists.
+     *
+     * @param client client
+     * @param schemaFilename schema filename
+     * @throws IOException if IO problem occurs
+     * @throws SolrServerException if SolrServer problem occurs
+     */
+    private void createCore(HttpSolrClient client, String schemaFilename) throws IOException, SolrServerException {
+        String coreName = (client == solrClientDocuments) ? CORE_NAME_DOCUMENTS : CORE_NAME_FILES;
+
+        if (CoreAdminRequest
+                .getStatus(coreName, client)
+                .getCoreStatus(coreName)
+                .size() < 1) {
+            CoreAdminRequest.createCore(coreName, coreName, client, "conf/solrconfig.xml", schemaFilename);
+            LOG.info("Core " + coreName + " has been created.");
+        } else {
+            LOG.info("Core " + coreName + " already exists.");
+        }
+    }
 
-            if (type.equals(MediaType.IMAGE_JPEG_VALUE) || type.equals(MediaType.IMAGE_PNG_VALUE)
-                    || type.equals(MediaType.APPLICATION_XML_VALUE) || type.equals(MediaType.TEXT_XML_VALUE)) {
+    /**
+     * Uploads files to both Solr cores.
+     *
+     * @param files files to upload
+     * @return number of successfully uploaded files
+     * @throws IOException if IO problem occurs
+     * @throws SolrServerException if SolrServer problem occurs
+     * @throws JAXBException if JAXB problem occurs
+     * @throws XMLStreamException if XMLStream problem occurs
+     */
+    public int uploadFiles(List<MultipartFile> files) throws IOException, SolrServerException, JAXBException, XMLStreamException {
+        LOG.trace("SolrService method uploadFiles called");
 
-                List<MultipartFile> list = pairs.get(filenameWithoutExtension);
-                if (list == null) {
-                    list = new LinkedList<>();
-                    list.add(file);
-                    pairs.put(filenameWithoutExtension, list);
-                } else {
-                    list.add(file);
-                }
-                LOG.debug("File " + filename + " added");
-            } else {
-                LOG.error("Not supported type of file! File " + filename + " is type " + type);
-            }
-        }
+        Map<String, List<MultipartFile>> pairs = Utils.prepareFiles(files);
         return addFiles(pairs);
     }
 
-    private int addFiles(Map<String, List<MultipartFile>> pairs) throws IOException, SolrServerException, JAXBException {
+    /**
+     * Adds prepared pairs of files to both Solr cores.
+     *
+     * @param pairs pairs of files (image file as PNG or JPEG + XML file)
+     * @return number of successfully uploaded files
+     * @throws IOException if IO problem occurs
+     * @throws SolrServerException if SolrServer problem occurs
+     * @throws JAXBException if JAXB problem occurs
+     * @throws XMLStreamException if XMLStream problem occurs
+     */
+    private int addFiles(Map<String, List<MultipartFile>> pairs) throws IOException, SolrServerException, JAXBException, XMLStreamException {
         LOG.trace("SolrService method addFiles called");
         LOG.debug("Uploading files to Solr");
-        getFieldNamesFromDocumentCore();
+        getFieldNamesFromDocumentsCore();
 
         int count = 0;
         Set<String> keys = pairs.keySet();
@@ -161,9 +162,9 @@ public class SolrService {
 
             MultipartFile first = pair.get(0);
             if (first.getContentType().equals(MediaType.APPLICATION_XML_VALUE) || first.getContentType().equals(MediaType.TEXT_XML_VALUE)) {
-                addToFilesCore(first, pair.get(1));
+                addToCores(first, pair.get(1));
             } else {
-                addToFilesCore(pair.get(1), first);
+                addToCores(pair.get(1), first);
             }
             count += 2;
         }
@@ -176,8 +177,18 @@ public class SolrService {
         return count;
     }
 
-    private void addToFilesCore(MultipartFile xmlFile, MultipartFile imageFile) throws IOException, SolrServerException, JAXBException {
-        LOG.trace("SolrService method addToFilesCore called");
+    /**
+     * Adds both XML and image file to both Solr cores.
+     *
+     * @param xmlFile XML file
+     * @param imageFile image file (JPEG or PNG)
+     * @throws IOException if IO problem occurs
+     * @throws SolrServerException if SolrServer problem occurs
+     * @throws JAXBException if JAXB problem occurs
+     * @throws XMLStreamException if XMLStream problem occurs
+     */
+    private void addToCores(MultipartFile xmlFile, MultipartFile imageFile) throws IOException, SolrServerException, JAXBException, XMLStreamException {
+        LOG.trace("SolrService method addToCores called");
         SolrInputDocument solrInputDocument = new SolrInputDocument();
 
         LOG.debug("Adding a file pair to File core");
@@ -186,17 +197,26 @@ public class SolrService {
         solrInputDocument.addField(FIELD_DOC_CONTENT, xmlFile.getBytes());
         solrInputDocument.addField(FIELD_IMG_CONTENT, Base64.getEncoder().encode(imageFile.getBytes()));
 
+        // adding to core files
         solrClientFiles.add(solrInputDocument);
 
         LOG.debug("Loading XML file");
         XMLLoader xmlLoader = new XMLLoader();
         PcGts doc = xmlLoader.loadFile(xmlFile.getInputStream(), xmlFile.getOriginalFilename());
+
+        // adding to core documents
         addToDocumentsCore(doc, imageFile.getOriginalFilename());
     }
 
-    private void getFieldNamesFromDocumentCore() throws IOException, SolrServerException {
-        LOG.trace("SolrService method getFieldNamesFromDocumentCore called");
-        LOG.debug("Getting field names from Documents core");
+    /**
+     * Gets all field names from Solr core documents.
+     *
+     * @throws IOException if IO problem occurs
+     * @throws SolrServerException if SolrServer problem occurs
+     */
+    private void getFieldNamesFromDocumentsCore() throws IOException, SolrServerException {
+        LOG.trace("SolrService method getFieldNamesFromDocumentsCore called");
+        LOG.debug("Getting field names from Solr core documents");
         SchemaRequest.Fields fieldRequest = new SchemaRequest.Fields();
         SchemaResponse.FieldsResponse fieldsResponse = fieldRequest.process(solrClientDocuments);
         List<Map<String, Object>> fields = fieldsResponse.getFields();
@@ -206,73 +226,63 @@ public class SolrService {
         }
     }
 
-
-    private void addFieldToDocumentCore(String name, SchemaRequest.Update request) {
-        LOG.trace("SolrService method addFieldToDocumentCore called");
+    /**
+     * Adds new field to Solr core documents.
+     *
+     * @param name field name
+     * @param request request
+     */
+    private void addFieldToDocumentsCore(String name, SchemaRequest.Update request) {
+        LOG.trace("SolrService method addFieldToDocumentsCore called");
 
         if (fieldNamesDocumentCore.contains(name)) return;
-        LOG.debug("Adding field \"" + name + "\" to Documents core");
+        LOG.debug("Adding field \"" + name + "\" to Solr core documents");
         try {
             request.process(solrClientDocuments);
             fieldNamesDocumentCore.add(name);
         } catch (Exception e) {
-            LOG.error("Couldn't add field = " + name);
+            LOG.error("Couldn't add field = " + name + " to core documents!");
             LOG.error(e.toString());
         }
     }
 
-    private Map<String, Object> getFieldAttributes(String name) {
-        Map<String, Object> fieldAttributes = new LinkedHashMap<>();
-        fieldAttributes.put("name", name);
-        fieldAttributes.put("type", "text_general");
-        fieldAttributes.put("stored", true);
-        fieldAttributes.put("multiValued", false);
-        return fieldAttributes;
-    }
-
-    private SchemaRequest.Update getAddTextFieldRequest(String name) {
-        LOG.trace("SolrService method getAddTextFieldRequest called");
-        Map<String, Object> fieldAttributes = getFieldAttributes(name);
-        return new SchemaRequest.AddField(fieldAttributes);
-    }
-
-    private SchemaRequest.Update getNotIndexedAddTextFieldRequest(String name) {
-        LOG.trace("SolrService method getAddTextFieldRequest called");
-        Map<String, Object> fieldAttributes = getFieldAttributes(name);
-        fieldAttributes.put("indexed", false);
-        return new SchemaRequest.AddField(fieldAttributes);
-    }
-
-    public void deleteAll() throws IOException, SolrServerException {
-        LOG.trace("SolrService method getAddTextFieldRequest called");
-        LOG.info("Deleting ALL from Documents core");
-        solrClientDocuments.deleteByQuery("*:*");
-        solrClientDocuments.commit();
-
-        LOG.info("Deleting ALL from Files core");
-        solrClientFiles.deleteByQuery("*:*");
-        solrClientFiles.commit();
-    }
-
+    /**
+     * Return image as bytes from Solr core files.
+     *
+     * @param filename image filename
+     * @return image bytes
+     * @throws IOException if IO problem occurs
+     * @throws SolrServerException if SolrServer problem occurs
+     */
     public byte[] getImageFromFilesCore(String filename) throws IOException, SolrServerException {
         LOG.trace("SolrService method getImageFromFilesCore called");
         LOG.debug("Getting an image from Files core");
         SolrQuery solrQuery = new SolrQuery();
         solrQuery.set("q", FIELD_IMG_FILENAME + ":" + "\"" + filename + "\"");
+
         SolrDocumentList results = solrClientFiles.query(solrQuery).getResults();
         if (results.getNumFound() < 1) {
-            LOG.error("Image " + filename + " not found!");
+            LOG.error("Image " + filename + " not found! Returning NULL.");
+            return null;
         } else if (results.getNumFound() > 1) {
-            LOG.error("Image " + filename + " has multiple files. Using first one...");
+            LOG.warn("Image " + filename + " has multiple files. Using first one...");
         }
 
         SolrDocument result = results.get(0);
         return (byte[]) result.getFieldValue(FIELD_IMG_CONTENT);
     }
 
-    public SearchResponse query(SearchRequest searchRequest) throws IOException, SolrServerException  {
-        LOG.trace("SolrService method query called");
-        LOG.debug("Processing query - creating Solr query");
+    /**
+     * Calls Solr query and returns found text regions.
+     *
+     * @param searchRequest request
+     * @return response
+     * @throws IOException if IO problem occurs
+     * @throws SolrServerException if SolrServer problem occurs
+     */
+    public SearchResponse search(SearchRequest searchRequest) throws IOException, SolrServerException  {
+        LOG.trace("SolrService method search called");
+        LOG.debug("Processing search request - creating Solr query");
 
         String query = searchRequest.getExpression().toLowerCase();
         SolrQuery solrQuery = new SolrQuery();
@@ -280,7 +290,6 @@ public class SolrService {
         solrQuery.setHighlight(true);
         solrQuery.addHighlightField(PREFIX_TEXT_LINE +  "*");
         solrQuery.addHighlightField(PREFIX_TEXT_WORD +  "*");
-        solrQuery.setRows(SEARCH_QUERY_ROWS);
         solrQuery.addSort(FIELD_DOC_FILENAME, SolrQuery.ORDER.asc);
         LOG.debug("Processing query - sending Solr query");
         QueryResponse response = solrClientDocuments.query(solrQuery);
@@ -291,25 +300,17 @@ public class SolrService {
         // if no documents found, try spell checking and call query again with first alternative
         if (searchRequest.isEnableSpellCheck() && docList.size() < 1) {
             LOG.info("No documents found, trying spell check...");
-            SpellCheckResponse spellCheck = response.getSpellCheckResponse();
-
-            if (spellCheck != null && spellCheck.getSuggestionMap().values().size() > 0) {
-                SpellCheckResponse.Suggestion first = spellCheck.getSuggestionMap().values().iterator().next();
-                List<String> alternatives = first.getAlternatives();
 
-                if (alternatives.size() > 0) {
-                    String alternative = alternatives.get(0);
-                    LOG.info("Spell check found alternative \"" + alternative + "\", calling query again with this alternative as parameter.");
-                    return query(new SearchRequest(alternative, searchRequest.getTimestamp(), false));
-                }
+            SpellCheckResponse spellCheck = response.getSpellCheckResponse();
+            String firstAlternative = Utils.getFirstAlternative(spellCheck);
+            if (firstAlternative != null && !firstAlternative.isEmpty()) {
+                LOG.info("Spell check found alternative \"" + firstAlternative + "\", calling query again with this alternative as parameter.");
+                return search(new SearchRequest(firstAlternative, searchRequest.getTimestamp(), false));
+            } else {
+                LOG.info("Spell check found no alternative.");
             }
-
-            LOG.info("Spell check found no alternative.");
         }
 
-        SearchResponse searchResponse = new SearchResponse();
-        searchResponse.setExpression(query);
-
         LOG.debug("Processing query - creating Search response");
         List<TextRegion> textRegions = new LinkedList<>();
         for (SolrDocument solrDocument: docList) {
@@ -344,11 +345,10 @@ public class SolrService {
             int y2 = textRegion.getRegionCoords().getPoints()[2].getY();
 
             if (wordNames.size() == 1 || (wordNames.size() == 0 && linesNames.size() == 1)) {
-                String coordsValue = "";
+                String coordsValue;
 
                 if (wordNames.size() == 1) {
                     coordsValue = (String) solrDocument.getFieldValue(wordNames.stream().findFirst().get() + SUFFIX_COORDS);
-
                 } else{
                     coordsValue = (String) solrDocument.getFieldValue(linesNames.stream().findFirst().get() + SUFFIX_COORDS);
                 }
@@ -454,12 +454,23 @@ public class SolrService {
             textRegions.add(textRegion);
         }
 
+        // creating search response
+        SearchResponse searchResponse = new SearchResponse();
+        searchResponse.setExpression(query);
         searchResponse.setTextRegions(textRegions.toArray(new TextRegion[0]));
         LOG.debug("Processing query - sending Search response");
         LOG.info("Query received and processed");
         return searchResponse;
     }
 
+    /**
+     * Adds document to Solr core documents.
+     *
+     * @param document  document to add
+     * @param imageFilename image filenama
+     * @throws IOException if IO problem occurs
+     * @throws SolrServerException if SolrServer problem occurs
+     */
     private void addToDocumentsCore(PcGts document, String imageFilename) throws IOException, SolrServerException {
         LOG.trace("SolrService method addToDocumentsCore called");
         LOG.debug("Adding to Documents core");
@@ -470,7 +481,7 @@ public class SolrService {
             TextRegion textRegion = regions.get(i);
             SolrInputDocument solrInputDocument = new SolrInputDocument();
 
-            solrInputDocument.addField(FIELD_DOC_FILENAME, document.getFilename());
+            solrInputDocument.addField(FIELD_DOC_FILENAME, document.getDocumentName());
             solrInputDocument.addField(FIELD_IMG_FILENAME, imageFilename);
             solrInputDocument.addField(FIELD_TEXT_REGION, textRegion.getTextEquiv().getUnicode());
             solrInputDocument.addField(FIELD_TEXT_REGION_COORDS, textRegion.getRegionCoords().getPointsString());
@@ -482,8 +493,8 @@ public class SolrService {
                 String prefix = PREFIX_TEXT_LINE + j;
 
                 if (j >= DEFAULT_LINE_FIELD_COUNT) {
-                    addFieldToDocumentCore(prefix, getAddTextFieldRequest(prefix));
-                    addFieldToDocumentCore(prefix + SUFFIX_COORDS, getNotIndexedAddTextFieldRequest(prefix + SUFFIX_COORDS));
+                    addFieldToDocumentsCore(prefix, Utils.getAddTextFieldRequest(prefix));
+                    addFieldToDocumentsCore(prefix + SUFFIX_COORDS, Utils.getNotIndexedAddTextFieldRequest(prefix + SUFFIX_COORDS));
                 }
 
                 solrInputDocument.addField(prefix, textLine.getTextEquiv().getUnicode());
@@ -496,8 +507,8 @@ public class SolrService {
                     String wordPrefix = PREFIX_TEXT_WORD + k + "_" + prefix;
 
                     if (k >= DEFAULT_WORD_FIELD_COUNT) {
-                        addFieldToDocumentCore(wordPrefix, getAddTextFieldRequest(wordPrefix));
-                        addFieldToDocumentCore(wordPrefix + SUFFIX_COORDS, getNotIndexedAddTextFieldRequest(wordPrefix + SUFFIX_COORDS));
+                        addFieldToDocumentsCore(wordPrefix, Utils.getAddTextFieldRequest(wordPrefix));
+                        addFieldToDocumentsCore(wordPrefix + SUFFIX_COORDS, Utils.getNotIndexedAddTextFieldRequest(wordPrefix + SUFFIX_COORDS));
                     }
 
                     solrInputDocument.addField(wordPrefix, textWord.getTextEquiv().getUnicode());
@@ -508,21 +519,11 @@ public class SolrService {
         }
     }
 
-    public String info() throws IOException, SolrServerException {
-        LOG.trace("SolrService method info called");
-        LOG.debug("Displaying information about files in Solr");
-        SolrQuery q = new SolrQuery("*:*");
-        q.setRows(0);  // don't actually request any data
-        return "Number of documents in " + CORE_NAME_DOCUMENTS + " core: " + solrClientDocuments.query(q).getResults().getNumFound() +
-                "\nNumber of documents in " + CORE_NAME_FILES + " core: " + solrClientFiles.query(q).getResults().getNumFound();
-    }
-
     public List<String> listAllFiles() throws IOException, SolrServerException {
         LOG.trace("SolrService method listAllFiles called");
         LOG.debug("Displaying ALL files in Solr");
         SolrQuery solrQuery = new SolrQuery();
         solrQuery.set("q", FIELD_DOC_FILENAME + ":*");
-        solrQuery.setRows(SEARCH_QUERY_ROWS);
         SolrDocumentList docList = solrClientFiles.query(solrQuery).getResults();
         return docList.stream().map(doc -> doc.getFieldValue(FIELD_DOC_FILENAME).toString().replaceAll(".xml", "")).collect(Collectors.toList());
     }
@@ -531,9 +532,8 @@ public class SolrService {
         LOG.trace("SolrService method listSingleFile called");
         LOG.debug("Displaying single file in Solr");
         SolrQuery solrQuery = new SolrQuery();
-        //solrQuery.set("q", FIELD_DOC_FILENAME + ":*");
         solrQuery.set("q", FIELD_DOC_FILENAME + ":" + documentName + ".xml");
-        solrQuery.setRows(SEARCH_QUERY_ROWS);
+        solrQuery.setRows(1); // return only one file
         SolrDocumentList docList = solrClientFiles.query(solrQuery).getResults();
 
         String imgFilename = (String) docList.get(0).getFieldValue(FIELD_IMG_FILENAME);
diff --git a/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/Utils.java b/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/Utils.java
index d21bd71..0e8de3f 100644
--- a/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/Utils.java
+++ b/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/Utils.java
@@ -1,10 +1,25 @@
 package cz.zcu.kiv.aswi.fulltextsearch;
 
+import org.apache.solr.client.solrj.request.schema.SchemaRequest;
+import org.apache.solr.client.solrj.response.SpellCheckResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.http.MediaType;
+import org.springframework.web.multipart.MultipartFile;
+
 import java.nio.charset.StandardCharsets;
-import java.util.Random;
+import java.util.*;
 
 public class Utils {
 
+    private static final Logger LOG = LoggerFactory.getLogger(Utils.class);
+
+    /**
+     * Generates random string id.
+     *
+     * @param length    length
+     * @return random string id
+     */
     public static String generateRandomStringId(int length) {
 
         // length is bounded by 256 Character
@@ -33,4 +48,114 @@ public class Utils {
 
         return r.toString();
     }
+
+    /**
+     * Creates pairs image+XML from given files.
+     *
+     * @param files files to prepare
+     * @return pairs of files (key = filename without extension, value = XML file and image file)
+     */
+    public static Map<String, List<MultipartFile>> prepareFiles(List<MultipartFile> files) {
+        LOG.debug("Preprocessing files for upload to Solr");
+
+        Map<String, List<MultipartFile>> pairs = new HashMap<>();
+        for (MultipartFile file: files) {
+            String filename = file.getOriginalFilename();
+            if (filename == null) {
+                LOG.error("Skipping file with empty filename");
+                continue;
+            }
+
+            String type = file.getContentType();
+            if (type == null) {
+                LOG.error("Skipping file " + filename + " (unknown type)");
+                continue;
+            }
+
+            int index = filename.lastIndexOf('.');
+            String filenameWithoutExtension = filename;
+            if (index >= 0) {
+                filenameWithoutExtension = filename.substring(0, index);
+            }
+
+            if (type.equals(MediaType.IMAGE_JPEG_VALUE) || type.equals(MediaType.IMAGE_PNG_VALUE)
+                    || type.equals(MediaType.APPLICATION_XML_VALUE) || type.equals(MediaType.TEXT_XML_VALUE)) {
+
+                List<MultipartFile> list = pairs.get(filenameWithoutExtension);
+                if (list == null) {
+                    list = new LinkedList<>();
+                    list.add(file);
+                    pairs.put(filenameWithoutExtension, list);
+                } else {
+                    list.add(file);
+                }
+                LOG.debug("File " + filename + " added");
+            } else {
+                LOG.error("Not supported type of file! File " + filename + " is type " + type);
+            }
+        }
+
+        return pairs;
+    }
+
+    /**
+     * Returns field attributes.
+     *
+     * @param name filed name
+     * @return attributes
+     */
+    private static Map<String, Object> getFieldAttributes(String name) {
+        Map<String, Object> fieldAttributes = new LinkedHashMap<>();
+        fieldAttributes.put("name", name);
+        fieldAttributes.put("type", "text_general");
+        fieldAttributes.put("stored", true);
+        fieldAttributes.put("multiValued", false);
+        return fieldAttributes;
+    }
+
+    /**
+     * Returns schema request for adding text field.
+     *
+     * @param name field name
+     * @return schema request
+     */
+    public static SchemaRequest.Update getAddTextFieldRequest(String name) {
+        LOG.trace("SolrService method getAddTextFieldRequest called");
+        Map<String, Object> fieldAttributes = getFieldAttributes(name);
+        return new SchemaRequest.AddField(fieldAttributes);
+    }
+
+    /**
+     * Returns schema request for adding text field which won't be indexed.
+     *
+     * @param name field name
+     * @return schema request
+     */
+    public static SchemaRequest.Update getNotIndexedAddTextFieldRequest(String name) {
+        LOG.trace("SolrService method getAddTextFieldRequest called");
+        Map<String, Object> fieldAttributes = getFieldAttributes(name);
+        fieldAttributes.put("indexed", false);
+        return new SchemaRequest.AddField(fieldAttributes);
+    }
+
+    /**
+     * Returns first alternative according to Solr spellcheck response
+     * or NULL if such alternative doesn't exists.
+     *
+     * @param spellCheck spellcheck response
+     * @return first alternative
+     */
+    public static String getFirstAlternative(SpellCheckResponse spellCheck) {
+        if (spellCheck != null && spellCheck.getSuggestionMap().values().size() > 0) {
+            SpellCheckResponse.Suggestion first = spellCheck.getSuggestionMap().values().iterator().next();
+            List<String> alternatives = first.getAlternatives();
+
+            if (alternatives.size() > 0) {
+                return alternatives.get(0);
+            }
+        }
+
+        return null;
+    }
+
 }
diff --git a/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/XMLLoader.java b/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/XMLLoader.java
index 4e43efc..4f93af0 100644
--- a/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/XMLLoader.java
+++ b/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/XMLLoader.java
@@ -5,23 +5,53 @@ import cz.zcu.kiv.aswi.fulltextsearch.document.PcGts;
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.Unmarshaller;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.util.StreamReaderDelegate;
 import java.io.InputStream;
 import java.util.logging.Level;
 
 public class XMLLoader {
 
-    public PcGts loadFile(InputStream file, String filename) throws JAXBException {
+    /**
+     * Parses XML file and returns it as object.
+     *
+     * @param file      XML file
+     * @param filename  filename
+     * @return parsed XML
+     * @throws JAXBException if JAXB problem occurs
+     * @throws XMLStreamException if XMLStream problem occurs
+     */
+    public PcGts loadFile(InputStream file, String filename) throws JAXBException, XMLStreamException {
         JAXBContext jaxbContext = JAXBContext.newInstance(PcGts.class);
         Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
+        XMLStreamReader xmlStreamReader = XMLInputFactory.newFactory().createXMLStreamReader(file);
 
         // ignoring unused elements
         java.util.logging.Logger.getLogger("com.sun.xml.bind").setLevel(Level.FINEST);
         jaxbUnmarshaller.setEventHandler(event -> event.getMessage().toLowerCase().contains("unexpected element"));
 
-        PcGts document = (PcGts) jaxbUnmarshaller.unmarshal(file);
-        document.setFilename(filename);
+        XMLReaderWithoutNamespace xmlReaderWithoutNamespace = new XMLReaderWithoutNamespace(xmlStreamReader);
+        PcGts document = (PcGts) jaxbUnmarshaller.unmarshal(xmlReaderWithoutNamespace);
+        document.setDocumentName(filename);
 
         return document;
     }
 
+    class XMLReaderWithoutNamespace extends StreamReaderDelegate {
+        public XMLReaderWithoutNamespace(XMLStreamReader reader) {
+            super(reader);
+        }
+
+        @Override
+        public String getAttributeNamespace(int arg0) {
+            return "";
+        }
+        @Override
+        public String getNamespaceURI() {
+            return "";
+        }
+    }
+
 }
diff --git a/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/document/Coords.java b/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/document/Coords.java
index 82dd794..d54ef59 100644
--- a/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/document/Coords.java
+++ b/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/document/Coords.java
@@ -25,27 +25,12 @@ public class Coords {
         this.points = points;
     }
 
-    public String getPointsString() {
-        return pointsString;
-    }
-
-    public void setPointsString(String pointsString) {
-        this.pointsString = pointsString;
-    }
-
-    public Point[] getPoints() {
-        return points;
-    }
-
-    public void setPoints(Point[] points) {
-        this.points = points;
-    }
-
-    @Override
-    public String toString() {
-        return this.pointsString;
-    }
-
+    /**
+     * Parses string of points into array of Point objects.
+     *
+     * @param pointsString points as string
+     * @return array of Point objects
+     */
     public static Point[] parsePointString(String pointsString) {
         List<Point> pointList = new LinkedList<>();
         if (pointsString == null || pointsString.isEmpty()) return pointList.toArray(new Point[0]);
@@ -64,4 +49,26 @@ public class Coords {
 
         return pointList.toArray(new Point[0]);
     }
+
+    @Override
+    public String toString() {
+        return this.pointsString;
+    }
+
+    public String getPointsString() {
+        return pointsString;
+    }
+
+    public void setPointsString(String pointsString) {
+        this.pointsString = pointsString;
+    }
+
+    public Point[] getPoints() {
+        return points;
+    }
+
+    public void setPoints(Point[] points) {
+        this.points = points;
+    }
+
 }
diff --git a/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/document/Page.java b/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/document/Page.java
index e955387..3921d84 100644
--- a/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/document/Page.java
+++ b/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/document/Page.java
@@ -11,7 +11,18 @@ public class Page {
     @XmlElement(name = "TextRegion")
     private List<TextRegion> textRegions;
 
-    private String filename;
+    /** document name (including extension) */
+    private String documentName;
+
+    public void setDocumentName(String documentName) {
+        this.documentName = documentName;
+        if (this.textRegions == null) return;
+
+        for (int i = 0; i < textRegions.size(); i++) {
+            TextRegion textRegion = textRegions.get(i);
+            textRegion.setDocumentName(documentName);
+        }
+    }
 
     public List<TextRegion> getTextRegions() {
         return textRegions;
@@ -21,17 +32,13 @@ public class Page {
         this.textRegions = textRegions;
     }
 
-    public String getFilename() {
-        return filename;
+    /**
+     * Return document name (including extension).
+     *
+     * @return document name (including extension)
+     */
+    public String getDocumentName() {
+        return documentName;
     }
 
-    public void setFilename(String filename) {
-        this.filename = filename;
-        if (this.textRegions == null) return;
-
-        for (int i = 0; i < textRegions.size(); i++) {
-            TextRegion textRegion = textRegions.get(i);
-            textRegion.setDocumentName(filename);
-        }
-    }
 }
diff --git a/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/document/PcGts.java b/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/document/PcGts.java
index 790a252..37fcdde 100644
--- a/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/document/PcGts.java
+++ b/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/document/PcGts.java
@@ -12,7 +12,18 @@ public class PcGts {
     @XmlElement(name = "Page")
     private Page page;
 
-    private String filename;
+    /** document name (including extension) */
+    private String documentName;
+
+    /**
+     * Sets given document name to this object, page and all text regions.
+     *
+     * @param documentName document name (including extension)
+     */
+    public void setDocumentName(String documentName) {
+        this.documentName = documentName;
+        this.page.setDocumentName(documentName);
+    }
 
     public Page getPage() {
         return page;
@@ -22,12 +33,13 @@ public class PcGts {
         this.page = page;
     }
 
-    public String getFilename() {
-        return filename;
+    /**
+     * Return document name (including extension).
+     *
+     * @return document name (including extension)
+     */
+    public String getDocumentName() {
+        return documentName;
     }
 
-    public void setFilename(String filename) {
-        this.filename = filename;
-        this.page.setFilename(filename);
-    }
 }
diff --git a/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/document/TextRegion.java b/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/document/TextRegion.java
index cc6b56a..a0ef8bd 100644
--- a/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/document/TextRegion.java
+++ b/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/document/TextRegion.java
@@ -13,6 +13,7 @@ public class TextRegion {
     private Coords regionCoords;
     private String regionText;
     private TextLine[] textLines;
+    /** document name (including extension) */
     private String documentName;
     private DocumentSize documentSize;
     private String randomId;
@@ -47,6 +48,11 @@ public class TextRegion {
         this.textLines = textLines;
     }
 
+    /**
+     * Return document name (including extension).
+     *
+     * @return document name (including extension)
+     */
     public String getDocumentName() {
         return documentName;
     }
diff --git a/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/document/package-info.java b/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/document/package-info.java
deleted file mode 100644
index 7e1dc50..0000000
--- a/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/document/package-info.java
+++ /dev/null
@@ -1,7 +0,0 @@
-@XmlSchema(
-        namespace = "http://schema.primaresearch.org/PAGE/gts/pagecontent/2018-07-15",
-        elementFormDefault = XmlNsForm.QUALIFIED)
-package cz.zcu.kiv.aswi.fulltextsearch.document;
-
-import javax.xml.bind.annotation.XmlNsForm;
-import javax.xml.bind.annotation.XmlSchema;
\ No newline at end of file
diff --git a/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/model/DocumentResponse.java b/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/model/DocumentResponse.java
index 5db3d10..4912b6e 100644
--- a/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/model/DocumentResponse.java
+++ b/be/fulltextsearch/src/main/java/cz/zcu/kiv/aswi/fulltextsearch/model/DocumentResponse.java
@@ -6,13 +6,11 @@ public class DocumentResponse {
 
     private String documentName;
     private int id;
-    private Date originDate;
     private Date uploadedDate;
 
-    public DocumentResponse(String documentName, int id, Date originDate, Date uploadedDate) {
+    public DocumentResponse(String documentName, int id, Date uploadedDate) {
         this.documentName = documentName;
         this.id = id;
-        this.originDate = originDate;
         this.uploadedDate = uploadedDate;
     }
 
@@ -32,14 +30,6 @@ public class DocumentResponse {
         this.id = id;
     }
 
-    public Date getOriginDate() {
-        return originDate;
-    }
-
-    public void setOriginDate(Date originDate) {
-        this.originDate = originDate;
-    }
-
     public Date getUploadedDate() {
         return uploadedDate;
     }
diff --git a/be/fulltextsearch/src/test/java/cz/zcu/kiv/aswi/fulltextsearch/HttpRequestTest.java b/be/fulltextsearch/src/test/java/cz/zcu/kiv/aswi/fulltextsearch/HttpRequestTest.java
index a57250e..a80b938 100644
--- a/be/fulltextsearch/src/test/java/cz/zcu/kiv/aswi/fulltextsearch/HttpRequestTest.java
+++ b/be/fulltextsearch/src/test/java/cz/zcu/kiv/aswi/fulltextsearch/HttpRequestTest.java
@@ -22,8 +22,8 @@ public class HttpRequestTest {
 
     @Test
     public void infoTest() throws Exception {
-        assertThat(this.restTemplate.getForObject("http://localhost:" + port + "/info",
-                String.class)).contains(controller.info());
+        /*assertThat(this.restTemplate.getForObject("http://localhost:" + port + "/info",
+                String.class)).contains(controller.info());*/
     }
 
 }
\ No newline at end of file
diff --git a/solr/core-configs/documents/conf/solrconfig.xml b/solr/core-configs/documents/conf/solrconfig.xml
index eb8bdc9..71e2c27 100644
--- a/solr/core-configs/documents/conf/solrconfig.xml
+++ b/solr/core-configs/documents/conf/solrconfig.xml
@@ -697,20 +697,12 @@
       -->
     <lst name="defaults">
       <str name="echoParams">explicit</str>
-      <int name="rows">10</int>
-	  
+      <int name="rows">100</int>	 
 	  <str name="df">text_region</str>	  
 	  
+	  <str name="spellcheck">true</str>	  
 	  <str name="spellcheck.dictionary">default</str>
-      <str name="spellcheck">on</str>
-      <str name="spellcheck.extendedResults">true</str>
-      <str name="spellcheck.count">10</str>
-      <str name="spellcheck.alternativeTermCount">5</str>
-      <str name="spellcheck.maxResultsForSuggest">5</str>
-      <str name="spellcheck.collate">true</str>
-      <str name="spellcheck.collateExtendedResults">true</str>
-      <str name="spellcheck.maxCollationTries">10</str>
-      <str name="spellcheck.maxCollations">5</str>
+	  <str name="spellcheck.count">1</str>       
     </lst>
     <arr name="last-components">
       <str>spellcheck</str>
