From e9da638521d7410177e34fca726f0ecefee53c6e Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Fri, 16 Nov 2018 15:27:23 +0100 Subject: [PATCH] jj: vector fields support for name generation and auto index --- Global_Indexer/ClassWindream.vb | 42 ++++++++++++++++----------------- Global_Indexer/frmIndex.vb | 15 +++++++++++- 2 files changed, 34 insertions(+), 23 deletions(-) diff --git a/Global_Indexer/ClassWindream.vb b/Global_Indexer/ClassWindream.vb index cf8fa6d..3524005 100644 --- a/Global_Indexer/ClassWindream.vb +++ b/Global_Indexer/ClassWindream.vb @@ -931,11 +931,6 @@ Public Class ClassWindream End If - 'indexe &= indexname & " = " & werte & vbNewLine - 'Der Indexierungsvorgang - ' Dim indexErgebnis As ArrayList = Indexiere(filenameZiel, _Indexname, werte) - 'Me.singleInfoNode.Insert(0, Me.singleInfoNode(1)) - 'Me.singleInfoNode.Insert(0, Me.singleInfoNode(0)) Dim arrIndex() As String = Nothing Dim arrValue() As String = Nothing ReDim Preserve arrIndex(0) @@ -944,8 +939,6 @@ Public Class ClassWindream arrValue(0) = _Value Return RunIndexing(WMObject, arrIndex, arrValue) - 'MsgBox(arr(0) & vbNewLine & indexe) - Catch ex As Exception ClassLogger.Add("Hinweis: Die Datei " & WD_File & " konnte nicht indexiert werden.") ClassLogger.Add("Fehler: " & ex.Message) @@ -1148,6 +1141,8 @@ Public Class ClassWindream Dim myArray() + + 'For Each row As DataRow In DT.Rows 'MsgBox(aName & vbNewLine & row.Item("Indexname") & vbNewLine & CStr(row.Item("Wert"))) 'Next @@ -1192,6 +1187,22 @@ Public Class ClassWindream 'Immer anfügen If LogErrorsOnly = False Then ClassLogger.Add(" >> Check Existing Vektorvalues", False) + + Dim indicies As New List(Of Object) + + For Each element In myArray + If TypeOf element Is String Then + Dim splitted = element.ToString.Split(ClassConstants.VECTORSEPARATOR) + For Each s In splitted + indicies.Add(s) + Next + Else + indicies.Add(element) + End If + Next + + myArray = indicies.ToArray() + VektorArray = Return_VektorArray(oDocument, aName, myArray) If VektorArray Is Nothing = False Then @@ -1207,12 +1218,6 @@ Public Class ClassWindream oDocument.Save() End If - - - - - - Else If LogErrorsOnly = False Then ClassLogger.Add(" >> Vektorfeld wird mit MEHREREN Werten gefüllt ", False) ' das ausgewählte Profil in _selectedProfile laden @@ -1289,16 +1294,8 @@ Public Class ClassWindream oDocument.Save() Return True End If - - - - End If - End If - - - End If i += 1 @@ -1419,7 +1416,8 @@ Public Class ClassWindream ''' ''' Führt das eigendliche Indexieren aus ''' - ''' Dateiname der zu indexierenden Datei + ''' + ''' der zu indexierenden Datei ''' Name des zu indexierenden Indexfeldes ''' Der Wert/die Werte die dem Index zugewiesen werden sollen ''' Liefert True wenn das Indexieren erfolgreich war, sonst False diff --git a/Global_Indexer/frmIndex.vb b/Global_Indexer/frmIndex.vb index c6def11..744d9df 100644 --- a/Global_Indexer/frmIndex.vb +++ b/Global_Indexer/frmIndex.vb @@ -1131,7 +1131,9 @@ Public Class frmIndex Dim optional_index As Boolean = ClassDatabase.Execute_Scalar("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & CURRENT_DOKART_ID & " AND UPPER(NAME) = UPPER('" & Indexname & "')", MyConnectionString, True) Dim value As String = GetManIndex_Value(Indexname, "FILE", optional_index) If value <> String.Empty Then - DATEINAME = DATEINAME.Replace(element.Value, value) + Dim firstVectorValue = value.Split(ClassConstants.VECTORSEPARATOR).First() + + DATEINAME = DATEINAME.Replace(element.Value, firstVectorValue) NewFileString = DATEINAME sql_history_INSERT_INTO = sql_history_INSERT_INTO & ", INDEX" & AnzahlIndexe.ToString AnzahlIndexe += 1 @@ -1382,6 +1384,17 @@ Public Class frmIndex If LogErrorsOnly = False Then ClassLogger.Add(" >> Auto Indexname: " & indexname.ToString, False) If LogErrorsOnly = False Then ClassLogger.Add(" >> Indexvalue: " & Indexvalue.ToString, False) Count += 1 + + ' den Typ des Zielindexes auslesen + Dim indexType As Integer = ClassWindream.GetTypeOfIndexAsIntByName(indexname) + + If indexType < ClassWindream.WMObjectVariableValueTypeVector Then + indexierung_erfolgreich = ClassWindream.DateiIndexieren(CURRENT_NEWFILENAME, indexname, Indexvalue) + Else + Dim indexArray = Split(Indexvalue, ClassConstants.VECTORSEPARATOR) + indexierung_erfolgreich = ClassWindream.Indexiere(CURRENT_NEWFILENAME.Substring(2), indexname, indexArray) + End If + indexierung_erfolgreich = ClassWindream.DateiIndexieren(CURRENT_NEWFILENAME, indexname, Indexvalue) If indexierung_erfolgreich = False Then MsgBox("Error in indexing file - See log", MsgBoxStyle.Critical)